Last active
August 29, 2015 14:09
-
-
Save mistakster/7b4263226dcd952d81d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var os = require('os'); | |
var fs = require('fs'); | |
var mustache = require('mustache'); | |
var config = require('./config/default.json'); | |
var userConfig = {}; | |
try { | |
userConfg = require('./config/' + os.hostname().toLowerCase() + '.json'); | |
} catch (ex) {} | |
for (var prop in userConfig) { | |
if (userConfig.hasOwnProperty(prop)) { | |
config[prop] = userConfig[prop]; | |
} | |
} | |
fs.readFile('./config/template.xml', function (err, data) { | |
if (err) throw err; | |
var output = mustache.render(data, config); | |
fs.writeFile('Web.config', output, function (err) { | |
if (err) throw err; | |
console.log('Done.'); | |
process.exit(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Конфигурация пользователя может храниться и вне проекта, чтобы исключить публикацию «чувствительных» данных.