mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-13 00:32:16 -05:00
Pass application name in from start scripts
- allows logger to log as correct application
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,10 +94,10 @@ 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 == "."
|
if character.isalnum() or character == "."
|
||||||
else "" for character in re.sub("\s+", ".", string.strip())
|
else "" for character in re.sub("\s+", ".", string.strip())
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def create_uuid():
|
def create_uuid():
|
||||||
|
|||||||
@@ -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