mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
6a778e8c17
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.
19 lines
482 B
JavaScript
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,
|
|
}
|
|
}
|
|
|