Initial commit of 1password-type config
This commit is contained in:
47
example/app_config.py
Normal file
47
example/app_config.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""Configuration from 1Password or other source."""
|
||||
|
||||
|
||||
def get_app_config_dict(vault_id):
|
||||
"""Gets the 1Password-style configuration dictionary for loading values.
|
||||
|
||||
Args:
|
||||
vault_id (str): The ID of the vault to retrieve values from
|
||||
|
||||
Returns:
|
||||
dict: Config dictionary
|
||||
"""
|
||||
app_config = {
|
||||
"secret_key": {
|
||||
"opitem": "DJANGO_SECRET_KEY",
|
||||
"opfield": ".password",
|
||||
},
|
||||
"email_api_key": {
|
||||
"opitem": "EXAMPLE_SENDGRID_API",
|
||||
"opfield": ".credential",
|
||||
},
|
||||
"server": {
|
||||
"opitem": "EXAMPLE_DB",
|
||||
"opfield": ".server",
|
||||
},
|
||||
"database": {
|
||||
"opitem": "EXAMPLE_DB",
|
||||
"opfield": ".database",
|
||||
},
|
||||
"username": {
|
||||
"opitem": "EXAMPLE_DB",
|
||||
"opfield": ".username",
|
||||
},
|
||||
"password": {
|
||||
"opitem": "EXAMPLE_DB",
|
||||
"opfield": ".password",
|
||||
},
|
||||
"port": {
|
||||
"opitem": "EXAMPLE_DB",
|
||||
"opfield": ".port",
|
||||
},
|
||||
}
|
||||
|
||||
for key in app_config:
|
||||
app_config[key]["opvault"] = vault_id
|
||||
|
||||
return app_config
|
||||
Reference in New Issue
Block a user