mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Merge pull request #158 from alphagov/set-application-name
Pass application name in from start scripts
This commit is contained in:
@@ -27,10 +27,12 @@ encryption = Encryption()
|
|||||||
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
|
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app(app_name=None):
|
||||||
application = Flask(__name__)
|
application = Flask(__name__)
|
||||||
|
|
||||||
application.config.from_object(os.environ['NOTIFY_API_ENVIRONMENT'])
|
application.config.from_object(os.environ['NOTIFY_API_ENVIRONMENT'])
|
||||||
|
if app_name:
|
||||||
|
application.config['NOTIFY_APP_NAME'] = app_name
|
||||||
|
|
||||||
init_app(application)
|
init_app(application)
|
||||||
db.init_app(application)
|
db.init_app(application)
|
||||||
@@ -92,9 +94,7 @@ def init_app(app):
|
|||||||
|
|
||||||
def email_safe(string):
|
def email_safe(string):
|
||||||
return "".join([
|
return "".join([
|
||||||
character.lower()
|
character.lower() if character.isalnum() or character == "." else "" for character in re.sub("\s+", ".", string.strip()) # noqa
|
||||||
if character.isalnum() or character == "."
|
|
||||||
else "" for character in re.sub("\s+", ".", string.strip())
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from app import notify_celery, create_app
|
from app import notify_celery, create_app
|
||||||
|
|
||||||
application = create_app()
|
application = create_app('delivery')
|
||||||
application.app_context().push()
|
application.app_context().push()
|
||||||
|
|||||||
Reference in New Issue
Block a user