Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Log error to console if deprecated config.js found (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
satterly authored Oct 1, 2018
1 parent c18a568 commit b305b96
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ var alerta = alerta || {};


angular.element(document).ready(function() {
var configJsCheck = function() {
$.ajax({
url: 'config.js',
type:'HEAD',
success: function() {
console.error(
'ERROR: Configuration in config.js file is no longer supported. ' +
'Use config.json file instead. See for more info: ' +
'https://docs.alerta.io/en/latest/webui.html'
);
},
error: function() {
console.log(
'INFO: Ignore 404 File not found errors for config.js files. ' +
'Checking for deprecated configuration in config.js file. [OK]'
);
}
});
};

var bootstrap = function() {
alerta.loadRoutes();
alerta.loadAuth();
Expand All @@ -15,7 +35,9 @@ angular.element(document).ready(function() {
}).always(function(localConfig) {
$.getJSON(localConfig.endpoint + '/config').done(function(remoteConfig) {
alerta.setConfig(remoteConfig);
}).then(function() {
})
.then(function() {
configJsCheck();
bootstrap();
});
});
Expand Down

0 comments on commit b305b96

Please sign in to comment.