-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #659 from OpenImaging/update-cloudamqp-credentials
Update cloudamqp credentials
- Loading branch information
Showing
2 changed files
with
48 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
APP = os.environ.get('APP', 'miqa-demo') | ||
|
||
for env_var, var_name in [('CLOUDAMQP_URL', 'cloudamqp_url'), ('DATABASE_URL', 'database_url')]: | ||
result = subprocess.run( | ||
['heroku', 'run', '-a', APP, 'echo', f'${env_var}'], | ||
capture_output=True | ||
) | ||
plaintext = result.stdout.decode().strip() | ||
print(f'{env_var}={plaintext}') | ||
|
||
subprocess.run( | ||
[ | ||
'ansible-vault', 'encrypt_string', | ||
'--vault-password-file=vault-password', | ||
plaintext, | ||
'--name', | ||
var_name, | ||
], | ||
stdout=sys.stdout, | ||
stderr=sys.stderr, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters