Setup reroutes when complete, fix gunicorn check

This commit is contained in:
Sam Chow 2018-08-31 13:16:20 -04:00
parent e711c1efe6
commit dbce986af6
5 changed files with 10 additions and 14 deletions

View file

@ -35,15 +35,11 @@ class SuperUserConfig(ApiResource):
'description': 'Updates the YAML config file', 'description': 'Updates the YAML config file',
'required': [ 'required': [
'config', 'config',
'hostname'
], ],
'properties': { 'properties': {
'config': { 'config': {
'type': 'object' 'type': 'object'
}, },
'hostname': {
'type': 'string'
},
'password': { 'password': {
'type': 'string' 'type': 'string'
}, },
@ -66,10 +62,9 @@ class SuperUserConfig(ApiResource):
# Note: This method is called to set the database configuration before super users exists, # Note: This method is called to set the database configuration before super users exists,
# so we also allow it to be called if there is no valid registry configuration setup. # so we also allow it to be called if there is no valid registry configuration setup.
config_object = request.get_json()['config'] config_object = request.get_json()['config']
hostname = request.get_json()['hostname']
# Add any enterprise defaults missing from the config. # Add any enterprise defaults missing from the config.
add_enterprise_config_defaults(config_object, app.config['SECRET_KEY'], hostname) add_enterprise_config_defaults(config_object, app.config['SECRET_KEY'])
# Write the configuration changes to the config override file. # Write the configuration changes to the config override file.
config_provider.save_config(config_object) config_provider.save_config(config_object)

View file

@ -278,7 +278,6 @@ const templateUrl = require('./setup.html');
'config': { 'config': {
'DB_URI': $scope.databaseUri 'DB_URI': $scope.databaseUri
}, },
'hostname': window.location.host
}; };
if ($scope.currentState.hasDatabaseSSLCert) { if ($scope.currentState.hasDatabaseSSLCert) {

View file

@ -12,8 +12,9 @@ def _check_gunicorn(endpoint):
client = app.config['HTTPCLIENT'] client = app.config['HTTPCLIENT']
hostname_parts = app.config['SERVER_HOSTNAME'].split(':') hostname_parts = app.config['SERVER_HOSTNAME'].split(':')
port = '' port = ''
if len(hostname_parts) == 2: if hostname_parts[0] == 'localhost':
port = ':' + hostname_parts[1] if len(hostname_parts) == 2:
port = ':' + hostname_parts[1]
scheme = app.config['PREFERRED_URL_SCHEME'] scheme = app.config['PREFERRED_URL_SCHEME']
if app.config.get('EXTERNAL_TLS_TERMINATION', False): if app.config.get('EXTERNAL_TLS_TERMINATION', False):

View file

@ -10,7 +10,11 @@
}) })
}]); }]);
function IncompleteSetupCtrl($scope, $timeout, ApiService, Features, UserService, ContainerService, CoreDialog) { function IncompleteSetupCtrl($scope, $location, $timeout, ApiService, Features, UserService, ContainerService, CoreDialog, Config) {
if (Config['SETUP_COMPLETE']) {
$location.path('/');
return;
}
if (!Features.SUPER_USERS) { if (!Features.SUPER_USERS) {
return; return;
} }

View file

@ -6,7 +6,7 @@ def generate_secret_key():
return str(cryptogen.getrandbits(256)) return str(cryptogen.getrandbits(256))
def add_enterprise_config_defaults(config_obj, current_secret_key, hostname): def add_enterprise_config_defaults(config_obj, current_secret_key):
""" Adds/Sets the config defaults for enterprise registry config. """ """ Adds/Sets the config defaults for enterprise registry config. """
# These have to be false. # These have to be false.
config_obj['TESTING'] = False config_obj['TESTING'] = False
@ -81,9 +81,6 @@ def add_enterprise_config_defaults(config_obj, current_secret_key, hostname):
config_obj['LOG_ARCHIVE_LOCATION'] = 'default' config_obj['LOG_ARCHIVE_LOCATION'] = 'default'
if not 'SERVER_HOSTNAME' in config_obj:
config_obj['SERVER_HOSTNAME'] = hostname
# Misc configuration. # Misc configuration.
config_obj['PREFERRED_URL_SCHEME'] = config_obj.get('PREFERRED_URL_SCHEME', 'http') config_obj['PREFERRED_URL_SCHEME'] = config_obj.get('PREFERRED_URL_SCHEME', 'http')
config_obj['ENTERPRISE_LOGO_URL'] = config_obj.get( config_obj['ENTERPRISE_LOGO_URL'] = config_obj.get(