mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #4091 from kensible/3865-config-updates
Removal of config.js and local_settings.json
This commit is contained in:
commit
de1b773a50
@ -1,59 +0,0 @@
|
|||||||
/*************************************************
|
|
||||||
* Copyright (c) 2015 Ansible, Inc.
|
|
||||||
*
|
|
||||||
* All Rights Reserved
|
|
||||||
*************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* config.js
|
|
||||||
*
|
|
||||||
* Gobal configuration variables for controlling application behavior.
|
|
||||||
*
|
|
||||||
* Do NOT change this file, unless the changes should be included in
|
|
||||||
* production builds. For development, copy this file to local_config.js,
|
|
||||||
* and make changes. git will ignore local_config.js
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*jshint unused:false */
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
//$.fn.modal.Constructor.DEFAULTS.backdrop = 'static';
|
|
||||||
|
|
||||||
return {
|
|
||||||
// custom_logo: true // load /var/lib/awx/public/static/assets/custom_console_logo.png as the login modal header. if false, will load the standard tower console logo
|
|
||||||
// custom_login_info: "example notice" // have a notice displayed in the login modal for users. note that, as a security measure, custom html is not supported and will be escaped.
|
|
||||||
|
|
||||||
password_length: 8, // Minimum user password length. Set to 0 to not set a limit
|
|
||||||
password_hasLowercase: true, // require a lowercase letter in the password
|
|
||||||
password_hasUppercase: false, // require an uppercase letter in the password
|
|
||||||
password_hasNumber: true, // require a number in the password
|
|
||||||
password_hasSymbol: false, // require one of these symbols to be
|
|
||||||
// in the password: -!$%^&*()_+|~=`{}[]:";'<>?,./
|
|
||||||
|
|
||||||
variable_edit_modes: { // Options we pass to ControlMirror for editing YAML/JSON variables
|
|
||||||
yaml: {
|
|
||||||
mode: "text/x-yaml",
|
|
||||||
matchBrackets: true,
|
|
||||||
autoCloseBrackets: true,
|
|
||||||
styleActiveLine: true,
|
|
||||||
lineNumbers: true,
|
|
||||||
gutters: ["CodeMirror-lint-markers"],
|
|
||||||
lint: true
|
|
||||||
},
|
|
||||||
json: {
|
|
||||||
mode: "application/json",
|
|
||||||
styleActiveLine: true,
|
|
||||||
matchBrackets: true,
|
|
||||||
autoCloseBrackets: true,
|
|
||||||
lineNumbers: true,
|
|
||||||
gutters: ["CodeMirror-lint-markers"],
|
|
||||||
lint: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
};
|
|
||||||
})();
|
|
@ -27,56 +27,58 @@ angular.module('LoadConfigHelper', ['Utilities'])
|
|||||||
function($log, $rootScope, $http, $location, ProcessErrors, Store) {
|
function($log, $rootScope, $http, $location, ProcessErrors, Store) {
|
||||||
return function() {
|
return function() {
|
||||||
|
|
||||||
if ($rootScope.removeLoadConfig) {
|
// These ettings used to be found in config.js, hardcoded now.
|
||||||
$rootScope.removeLoadConfig();
|
var configSettings = {
|
||||||
|
// custom_logo: true, // load /var/lib/awx/public/static/assets/custom_console_logo.png as the login modal header. if false, will load the standard tower console logo
|
||||||
|
// custom_login_info: "example notice", // have a notice displayed in the login modal for users. note that, as a security measure, custom html is not supported and will be escaped.
|
||||||
|
"tooltip_delay": {
|
||||||
|
"show": 500,
|
||||||
|
"hide": 100
|
||||||
|
},
|
||||||
|
"password_length": 8,
|
||||||
|
"password_hasLowercase": true,
|
||||||
|
"password_hasUppercase": false,
|
||||||
|
"password_hasNumber": true,
|
||||||
|
"password_hasSymbol": false,
|
||||||
|
"variable_edit_modes": {
|
||||||
|
"yaml": {
|
||||||
|
"mode": "text/x-yaml",
|
||||||
|
"matchBrackets": true,
|
||||||
|
"autoCloseBrackets": true,
|
||||||
|
"styleActiveLine": true,
|
||||||
|
"lineNumbers": true,
|
||||||
|
"gutters": ["CodeMirror-lint-markers"],
|
||||||
|
"lint": true
|
||||||
|
},
|
||||||
|
"json": {
|
||||||
|
"mode": "application/json",
|
||||||
|
"styleActiveLine": true,
|
||||||
|
"matchBrackets": true,
|
||||||
|
"autoCloseBrackets": true,
|
||||||
|
"lineNumbers": true,
|
||||||
|
"gutters": ["CodeMirror-lint-markers"],
|
||||||
|
"lint": true
|
||||||
}
|
}
|
||||||
$rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() {
|
},
|
||||||
$rootScope.enteredPath = $location.path();
|
};
|
||||||
// Load js/local_settings.json
|
|
||||||
$http({ method:'GET', url: $basePath + 'local_settings.json' })
|
// Auto-resolving what used to be found when attempting to load local_setting.json
|
||||||
.then(function(response) {
|
|
||||||
$log.info('loaded local_settings.json');
|
|
||||||
if(angular.isObject(response.data)){
|
|
||||||
global.$AnsibleConfig = _.extend($AnsibleConfig, response.data);
|
|
||||||
Store('AnsibleConfig', global.$AnsibleConfig);
|
|
||||||
if ($rootScope.loginConfig) {
|
if ($rootScope.loginConfig) {
|
||||||
$rootScope.loginConfig.resolve('config loaded');
|
$rootScope.loginConfig.resolve('config loaded');
|
||||||
}
|
}
|
||||||
$rootScope.$emit('ConfigReady');
|
$rootScope.$emit('ConfigReady');
|
||||||
}
|
|
||||||
else {
|
|
||||||
$log.info('local_settings.json is not a valid object');
|
|
||||||
if ($rootScope.loginConfig) {
|
|
||||||
$rootScope.loginConfig.resolve('config loaded');
|
|
||||||
}
|
|
||||||
$rootScope.$emit('ConfigReady');
|
|
||||||
}
|
|
||||||
|
|
||||||
}, function() {
|
// Load new hardcoded settings from above
|
||||||
//local_settings.json not found
|
// TODO Add a check for a custom image to add to the settings.
|
||||||
$log.info('local_settings.json not found');
|
// Update flag to true
|
||||||
if ($rootScope.loginConfig) {
|
// in loginModal.controller load the base64 src
|
||||||
$rootScope.loginConfig.resolve('config loaded');
|
// change partial to use base65 in the img src
|
||||||
}
|
|
||||||
$rootScope.$emit('ConfigReady');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
global.$AnsibleConfig = configSettings;
|
||||||
// load config.js
|
|
||||||
$log.info('attempting to load config.js');
|
|
||||||
$http({ method:'GET', url: $basePath + 'config.js' })
|
|
||||||
.then(function(response) {
|
|
||||||
$log.info('loaded config.js');
|
|
||||||
global.$AnsibleConfig = eval(response.data);
|
|
||||||
Store('AnsibleConfig', global.$AnsibleConfig);
|
Store('AnsibleConfig', global.$AnsibleConfig);
|
||||||
$rootScope.$emit('LoadConfig');
|
$rootScope.$emit('LoadConfig');
|
||||||
})
|
|
||||||
.catch(function(response) {
|
|
||||||
response.data = 'Failed to load ' + $basePath + '/config.js';
|
|
||||||
ProcessErrors($rootScope, response, response.status, null, { hdr: 'Error!',
|
|
||||||
msg: 'Failed to load ' + $basePath + '/config.js.'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user