Better config defaults and remove some unneeded code
This commit is contained in:
parent
40d2b1748f
commit
219730c341
6 changed files with 657 additions and 649 deletions
|
@ -7,25 +7,10 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
|||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'isActive': '=isActive'
|
||||
},
|
||||
controller: function($rootScope, $scope, $element, $timeout) {
|
||||
$scope.config = {
|
||||
'DB_URI': 'mysql+pymysql://jschorr:somepassword@mymysql.server.somewhere:768/mydb',
|
||||
'PREFERRED_URL_SCHEME': 'https',
|
||||
'FEATURE_USER_CREATION': true,
|
||||
'DISTRIBUTED_STORAGE_CONFIG': {'local': ['LocalStorage', {'storage_path': '/datastorage/registry'}]},
|
||||
'AUTHENTICATION_TYPE': 'Database'
|
||||
}
|
||||
|
||||
$scope.generateKey = function() {
|
||||
var d = new Date().getTime();
|
||||
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = (d + Math.random()*16)%16 | 0;
|
||||
d = Math.floor(d/16);
|
||||
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
|
||||
});
|
||||
$scope.config['SECRET_KEY'] = uuid;
|
||||
};
|
||||
controller: function($rootScope, $scope, $element, $timeout, ApiService) {
|
||||
$scope.config = null;
|
||||
|
||||
$scope.parseDbUri = function(value) {
|
||||
if (!value) { return null; }
|
||||
|
@ -55,6 +40,14 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
|||
uri = uri && uri.toString();
|
||||
return uri;
|
||||
};
|
||||
|
||||
$scope.$watch('isActive', function(value) {
|
||||
if (!value) { return; }
|
||||
|
||||
ApiService.scGetConfig().then(function(resp) {
|
||||
$scope.config = resp['config'];
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue