mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-26 09:05:13 +01:00
cyphernodeconf can take password from env for automatic lunanode setup
This commit is contained in:
7
dist/setup.sh
vendored
7
dist/setup.sh
vendored
@@ -135,9 +135,14 @@ configure() {
|
||||
clear && echo "Thinking..."
|
||||
fi
|
||||
|
||||
PW_ENV=''
|
||||
if [[ $CFG_PASSWORD ]]; then
|
||||
PW_ENV=" -e CFG_PASSWORD=$CFG_PASSWORD"
|
||||
fi
|
||||
|
||||
# configure features of cyphernode
|
||||
docker run -v $current_path:/data \
|
||||
--log-driver=none\
|
||||
--log-driver=none$PW_ENV \
|
||||
--rm -it cyphernodeconf:latest $(id -u):$(id -g) yo --no-insight cyphernode $recreate
|
||||
}
|
||||
|
||||
|
||||
@@ -81,16 +81,21 @@ module.exports = class extends Generator {
|
||||
async _initConfig() {
|
||||
if( fs.existsSync(this.destinationPath('config.7z')) ) {
|
||||
let r = {};
|
||||
while( !r.password ) {
|
||||
r = await this.prompt([{
|
||||
type: 'password',
|
||||
name: 'password',
|
||||
message: chalk.bold.blue('Enter your configuration password?'),
|
||||
filter: this._trimFilter
|
||||
}]);
|
||||
|
||||
if( process.env.CFG_PASSWORD ) {
|
||||
this.configurationPassword = process.env.CFG_PASSWORD;
|
||||
} else {
|
||||
process.stdout.write(reset);
|
||||
while( !r.password ) {
|
||||
r = await this.prompt([{
|
||||
type: 'password',
|
||||
name: 'password',
|
||||
message: chalk.bold.blue('Enter your configuration password?'),
|
||||
filter: this._trimFilter
|
||||
}]);
|
||||
}
|
||||
this.configurationPassword = r.password;
|
||||
}
|
||||
|
||||
this.configurationPassword = r.password;
|
||||
|
||||
const archive = new Archive( this.destinationPath('config.7z'), this.configurationPassword );
|
||||
|
||||
@@ -121,6 +126,7 @@ module.exports = class extends Generator {
|
||||
|
||||
} else {
|
||||
let r = {};
|
||||
process.stdout.write(reset);
|
||||
while( !r.password0 || !r.password1 || r.password0 !== r.password1 ) {
|
||||
|
||||
if( r.password0 && r.password1 && r.password0 !== r.password1 ) {
|
||||
@@ -152,7 +158,6 @@ module.exports = class extends Generator {
|
||||
|
||||
async prompting() {
|
||||
|
||||
process.stdout.write(reset);
|
||||
await this._initConfig();
|
||||
await sleep(1000);
|
||||
await splash();
|
||||
|
||||
Reference in New Issue
Block a user