2014-11-12 06:14:37 -05:00
|
|
|
var Crypto = require('crypto')
|
|
|
|
var fs = require('fs')
|
2013-06-13 09:21:14 -05:00
|
|
|
|
|
|
|
module.exports = function create_config() {
|
2014-11-12 06:14:37 -05:00
|
|
|
var pass = Crypto.randomBytes(8).toString('base64').replace(/[=+\/]/g, '')
|
|
|
|
var pass_digest = Crypto.createHash('sha1').update(pass).digest('hex')
|
2014-02-23 12:20:50 -05:00
|
|
|
|
2014-11-12 06:14:37 -05:00
|
|
|
/*eslint no-sync:0*/
|
|
|
|
var config = fs.readFileSync(require.resolve('./config_def.yaml'), 'utf8')
|
2014-02-23 12:20:50 -05:00
|
|
|
|
2014-11-12 06:14:37 -05:00
|
|
|
config = config.replace('__PASSWORD__', pass_digest)
|
2013-06-13 09:21:14 -05:00
|
|
|
|
2014-11-12 06:14:37 -05:00
|
|
|
return {
|
|
|
|
yaml: config,
|
|
|
|
user: 'admin',
|
|
|
|
pass: pass,
|
|
|
|
}
|
2013-06-13 09:21:14 -05:00
|
|
|
}
|
|
|
|
|