mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Merge pull request #63 from alphagov/read-environment-from-file
Added code to read environemnt from a file
This commit is contained in:
10
config.py
10
config.py
@@ -36,12 +36,22 @@ class Test(Development):
|
|||||||
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_notification_api'
|
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_notification_api'
|
||||||
|
|
||||||
|
|
||||||
|
class Preview(Config):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Staging(Config):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Live(Config):
|
class Live(Config):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
configs = {
|
configs = {
|
||||||
'development': Development,
|
'development': Development,
|
||||||
|
'preview': Preview,
|
||||||
|
'staging': Staging,
|
||||||
'test': Test,
|
'test': Test,
|
||||||
'live': Live,
|
'live': Live,
|
||||||
}
|
}
|
||||||
|
|||||||
10
wsgi.py
10
wsgi.py
@@ -1,9 +1,17 @@
|
|||||||
from app import create_app
|
from app import create_app
|
||||||
from credstash import getAllSecrets
|
from credstash import getAllSecrets
|
||||||
|
import os
|
||||||
|
|
||||||
|
config = 'live'
|
||||||
|
default_env_file = '/home/ubuntu/environment'
|
||||||
|
|
||||||
|
if os.path.isfile(default_env_file):
|
||||||
|
environment = open(default_env_file, 'r')
|
||||||
|
config = environment.readline().strip()
|
||||||
|
|
||||||
secrets = getAllSecrets(region="eu-west-1")
|
secrets = getAllSecrets(region="eu-west-1")
|
||||||
|
|
||||||
application = create_app('live', secrets)
|
application = create_app(config, secrets)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
application.run()
|
application.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user