Better config defaults and remove some unneeded code

This commit is contained in:
Joseph Schorr 2015-01-05 13:01:32 -05:00
parent 40d2b1748f
commit 219730c341
6 changed files with 657 additions and 649 deletions

View file

@ -36,7 +36,7 @@ def set_config_value(config_file, config_key, value):
export_yaml(config_obj, config_file)
def add_enterprise_config_defaults(config_obj, current_secret_key):
def add_enterprise_config_defaults(config_obj, current_secret_key, hostname):
""" Adds/Sets the config defaults for enterprise registry config. """
# These have to be false.
config_obj['TESTING'] = False
@ -50,6 +50,10 @@ def add_enterprise_config_defaults(config_obj, current_secret_key):
config_obj['FEATURE_MAILING'] = config_obj.get('FEATURE_MAILING', False)
config_obj['FEATURE_BUILD_SUPPORT'] = config_obj.get('FEATURE_BUILD_SUPPORT', False)
# Default auth type.
if not 'AUTHENTICATION_TYPE' in config_obj:
config_obj['AUTHENTICATION_TYPE'] = 'Database'
# Default secret key.
if not 'SECRET_KEY' in config_obj:
config_obj['SECRET_KEY'] = current_secret_key
@ -58,12 +62,15 @@ def add_enterprise_config_defaults(config_obj, current_secret_key):
if not 'DISTRIBUTED_STORAGE_CONFIG' in config_obj:
config_obj['DISTRIBUTED_STORAGE_PREFERENCE'] = ['local']
config_obj['DISTRIBUTED_STORAGE_CONFIG'] = {
'local': ['LocalStorage', { 'storage_path': '/datastorage/registry' }]
'local': ['LocalStorage', {'storage_path': '/datastorage/registry'}]
}
config_obj['USERFILES_LOCATION'] = 'local'
config_obj['USERFILES_PATH'] = 'userfiles/'
if not 'SERVER_HOSTNAME' in config_obj:
config_obj['SERVER_HOSTNAME'] = hostname
# Misc configuration.
config_obj['PREFERRED_URL_SCHEME'] = config_obj.get('PREFERRED_URL_SCHEME', 'http')
config_obj['ENTERPRISE_LOGO_URL'] = config_obj.get('ENTERPRISE_LOGO_URL',