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