mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
17 lines
448 B
JavaScript
17 lines
448 B
JavaScript
|
var fs = require('fs');
|
||
|
var crypto = require('crypto');
|
||
|
|
||
|
module.exports = function create_config() {
|
||
|
var pass = crypto.randomBytes(8).toString('base64').replace(/[=+\/]/g, '');
|
||
|
var pass_digest = crypto.createHash('sha1').update(pass).digest('hex');
|
||
|
var config = fs.readFileSync(require.resolve('./config_def.yaml'), 'utf8');
|
||
|
config = config.replace('__PASSWORD__', pass_digest);
|
||
|
|
||
|
return {
|
||
|
yaml: config,
|
||
|
user: 'admin',
|
||
|
pass: pass,
|
||
|
};
|
||
|
}
|
||
|
|