0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/lib/config_gen.js
Alex Kocharin 6a778e8c17 change code style to jshttp
close #155, see reasons there

This is a huge commit, so let me know if it will cause
any trouble, I might consider reverting it if it's the case.
2014-11-12 17:37:43 +03:00

19 lines
482 B
JavaScript

var Crypto = require('crypto')
var fs = require('fs')
module.exports = function create_config() {
var pass = Crypto.randomBytes(8).toString('base64').replace(/[=+\/]/g, '')
var pass_digest = Crypto.createHash('sha1').update(pass).digest('hex')
/*eslint no-sync:0*/
var config = fs.readFileSync(require.resolve('./config_def.yaml'), 'utf8')
config = config.replace('__PASSWORD__', pass_digest)
return {
yaml: config,
user: 'admin',
pass: pass,
}
}