Skip to content

Commit

Permalink
feat: add a production environment config (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmundy committed Jun 29, 2019
1 parent 8d60de8 commit 6947a73
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,27 @@ Second, define the foreign key in the `foreignKeys` array:
]
}
}
```
```
### Configuration Parameters
RELATIVE_PATH
ABSOLUTE_PATH
ROOT_PATH
MIGRATION_HOME
DATA_RESOURCE_SLEEP_INTERVAL
DATA_MODEL_SLEEP_INTERVAL
SQLALCHEMY_TRACK_MODIFICATIONS
PROPAGATE_EXCEPTIONS
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_DATABASE
POSTGRES_HOSTNAME
POSTGRES_PORT
SQLALCHEMY_DATABASE_URI
OAUTH2_PROVIDER
OAUTH2_URL
OAUTH2_JWKS_URL
OAUTH2_AUDIENCE
OAUTH2_ALGORITHMS
SECRET_MANAGER
9 changes: 9 additions & 0 deletions data_resource_api/config/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class Config(object):
OAUTH2_AUDIENCE = os.getenv('OAUTH2_AUDIENCE', 'http://localhost:8000')
OAUTH2_ALGORITHMS = ['RS256']

# Secret Manager
SECRET_MANAGER = None

@staticmethod
def get_oauth2_provider():
"""Retrieve the OAuth 2.0 Provider.
Expand Down Expand Up @@ -144,6 +147,12 @@ class ProductionConfig(Config):
def __init__(self):
super().__init__()

SECRET_MANAGER = os.getenv('SECRET_MANAGER', 'environment').upper()
if SECRET_MANAGER == 'ENVIRONMENT':
print('Pulling from environment')
elif SECRET_MANAGER == 'SSM':
print('AWS has our secrets')


class ConfigurationFactory(object):
"""A factory for handling configuration object creation.
Expand Down

0 comments on commit 6947a73

Please sign in to comment.