Allow local config.json to overwrite defaults.
This commit is contained in:
parent
ddb629c320
commit
1aba5ccd2e
|
@ -6,6 +6,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"body-parser": "~1.3.0",
|
"body-parser": "~1.3.0",
|
||||||
"compression": "~1.0.6",
|
"compression": "~1.0.6",
|
||||||
|
"deep-extend": "~0.2.10",
|
||||||
"express": "~4.4.1",
|
"express": "~4.4.1",
|
||||||
"glob": "~4.0.2",
|
"glob": "~4.0.2",
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ffffng').factory('config', function () {
|
angular.module('ffffng').factory('config', function (fs, deepExtend) {
|
||||||
return {
|
var defaultConfig = {
|
||||||
server: {
|
server: {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
peersPath: '/tmp/peers'
|
peersPath: '/tmp/peers'
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
community: {
|
community: {
|
||||||
name: 'Freifunk Hamburg',
|
name: 'Freifunk Musterstadt',
|
||||||
domain: 'hamburg.freifunk.net',
|
domain: 'musterstadt.freifunk.net',
|
||||||
contactEmail: 'kontakt@hamburg.freifunk.net'
|
contactEmail: 'kontakt@musterstadt.freifunk.net'
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
graphUrl: 'http://graph.hamburg.freifunk.net/graph.html',
|
graphUrl: 'http://graph.musterstadt.freifunk.net/graph.html',
|
||||||
mapUrl: 'http://graph.hamburg.freifunk.net/geomap.html'
|
mapUrl: 'http://graph.musterstadt.freifunk.net/geomap.html'
|
||||||
},
|
},
|
||||||
coordsSelector: {
|
coordsSelector: {
|
||||||
lat: 53.565278,
|
lat: 53.565278,
|
||||||
|
@ -23,4 +23,13 @@ angular.module('ffffng').factory('config', function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var configJSONFile = __dirname + "/../config.json";
|
||||||
|
var configJSON = undefined;
|
||||||
|
|
||||||
|
if (fs.existsSync(configJSONFile)) {
|
||||||
|
configJSON = JSON.parse(fs.readFileSync(configJSONFile, 'utf8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return deepExtend({}, defaultConfig, configJSON);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,4 +17,5 @@
|
||||||
lib('crypto');
|
lib('crypto');
|
||||||
lib('fs');
|
lib('fs');
|
||||||
lib('glob');
|
lib('glob');
|
||||||
|
lib('deepExtend', 'deep-extend');
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue