mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Make logo CDN domain into simple config
Having this as a function which does string parsing and manipulation surprised me a bit when I was trying to figure out why something wasn’t working. It’s more in line with the way we do other config like this (for example `ASSET_PATH`) to make it a simple config variable, rather than trying to be clever and guess things based on other config variables. It’s also less code, and is explicit enough that it doesn’t need tests.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
from functools import wraps
|
||||
from itertools import chain
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from flask import abort, current_app, g, make_response, request
|
||||
from flask import abort, g, make_response, request
|
||||
from flask_login import current_user
|
||||
from notifications_utils.field import Field
|
||||
from orderedset._orderedset import OrderedSet
|
||||
@@ -36,18 +35,6 @@ def get_help_argument():
|
||||
return request.args.get('help') if request.args.get('help') in ('1', '2', '3') else None
|
||||
|
||||
|
||||
def get_logo_cdn_domain():
|
||||
parsed_uri = urlparse(current_app.config['ADMIN_BASE_URL'])
|
||||
|
||||
if parsed_uri.netloc.startswith('localhost'):
|
||||
return 'static-logos.notify.tools'
|
||||
|
||||
subdomain = parsed_uri.hostname.split('.')[0]
|
||||
domain = parsed_uri.netloc[len(subdomain + '.'):]
|
||||
|
||||
return "static-logos.{}".format(domain)
|
||||
|
||||
|
||||
def parse_filter_args(filter_dict):
|
||||
if not isinstance(filter_dict, MultiDict):
|
||||
filter_dict = MultiDict(filter_dict)
|
||||
|
||||
Reference in New Issue
Block a user