@@ -9,7 +9,7 @@ const fs = require('fs');
9
9
const cipher = require ( './cipher' ) ;
10
10
const authStore = path . resolve ( __dirname , cipher . astore ) ;
11
11
const authBase = path . basename ( path . dirname ( authStore ) ) ;
12
- const { Writable } = require ( 'stream' ) ;
12
+ const { Writable} = require ( 'stream' ) ;
13
13
14
14
const mutableStdout = new Writable ( {
15
15
write ( chunk , encoding , callback ) {
@@ -61,65 +61,65 @@ const saveAuth = (obj, filename) => new Promise((resolve, reject) => {
61
61
62
62
const updateRabbit = ( ) => new Promise ( ( resolve , reject ) => {
63
63
question ( 'Update RabbitMQ account?[yes/no]' )
64
- . then ( ( answer ) => {
65
- answer = answer . toLowerCase ( ) ;
66
- if ( answer !== 'y' && answer !== 'yes' ) {
67
- resolve ( ) ;
68
- return ;
69
- }
70
- question ( `(${ authBase } ) Enter username of rabbitmq: ` )
71
- . then ( ( username ) => {
72
- question ( `(${ authBase } ) Enter password of rabbitmq: ` )
73
- . then ( ( password ) => {
74
- mutableStdout . muted = false ;
75
- saveAuth ( { rabbit : { username, password } } , authStore )
76
- . then ( resolve )
77
- . catch ( reject ) ;
64
+ . then ( ( answer ) => {
65
+ answer = answer . toLowerCase ( ) ;
66
+ if ( answer !== 'y' && answer !== 'yes' ) {
67
+ resolve ( ) ;
68
+ return ;
69
+ }
70
+ question ( `(${ authBase } ) Enter username of rabbitmq: ` )
71
+ . then ( ( username ) => {
72
+ question ( `(${ authBase } ) Enter password of rabbitmq: ` )
73
+ . then ( ( password ) => {
74
+ mutableStdout . muted = false ;
75
+ saveAuth ( { rabbit : { username, password} } , authStore )
76
+ . then ( resolve )
77
+ . catch ( reject ) ;
78
+ } ) ;
79
+ mutableStdout . muted = true ;
78
80
} ) ;
79
- mutableStdout . muted = true ;
80
- } ) ;
81
- } ) ;
81
+ } ) ;
82
82
} ) ;
83
83
84
84
const updateMongo = ( ) => new Promise ( ( resolve , reject ) => {
85
85
question ( 'Update MongoDB account?[yes/no]' )
86
- . then ( ( answer ) => {
87
- answer = answer . toLowerCase ( ) ;
88
- if ( answer !== 'y' && answer !== 'yes' ) {
89
- resolve ( ) ;
90
- return ;
91
- }
92
- question ( `(${ authBase } ) Enter username of mongodb: ` )
93
- . then ( ( username ) => {
94
- question ( `(${ authBase } ) Enter password of mongodb: ` )
95
- . then ( ( password ) => {
96
- mutableStdout . muted = false ;
97
- saveAuth ( { mongo : { username, password } } , authStore )
98
- . then ( resolve )
99
- . catch ( reject ) ;
86
+ . then ( ( answer ) => {
87
+ answer = answer . toLowerCase ( ) ;
88
+ if ( answer !== 'y' && answer !== 'yes' ) {
89
+ resolve ( ) ;
90
+ return ;
91
+ }
92
+ question ( `(${ authBase } ) Enter username of mongodb: ` )
93
+ . then ( ( username ) => {
94
+ question ( `(${ authBase } ) Enter password of mongodb: ` )
95
+ . then ( ( password ) => {
96
+ mutableStdout . muted = false ;
97
+ saveAuth ( { mongo : { username, password} } , authStore )
98
+ . then ( resolve )
99
+ . catch ( reject ) ;
100
+ } ) ;
101
+ mutableStdout . muted = true ;
100
102
} ) ;
101
- mutableStdout . muted = true ;
102
- } ) ;
103
- } ) ;
103
+ } ) ;
104
104
} ) ;
105
105
106
106
const updateInternal = ( ) => new Promise ( ( resolve , reject ) => {
107
107
question ( 'Update internal passphrase?[yes/no]' )
108
- . then ( ( answer ) => {
109
- answer = answer . toLowerCase ( ) ;
110
- if ( answer !== 'y' && answer !== 'yes' ) {
111
- resolve ( ) ;
112
- return ;
113
- }
114
- question ( `(${ authBase } ) Enter internal passphrase: ` )
115
- . then ( ( passphrase ) => {
116
- mutableStdout . muted = false ;
117
- saveAuth ( { internalPass : passphrase } , authStore )
118
- . then ( resolve )
119
- . catch ( reject ) ;
120
- } ) ;
121
- mutableStdout . muted = true ;
122
- } ) ;
108
+ . then ( ( answer ) => {
109
+ answer = answer . toLowerCase ( ) ;
110
+ if ( answer !== 'y' && answer !== 'yes' ) {
111
+ resolve ( ) ;
112
+ return ;
113
+ }
114
+ question ( `(${ authBase } ) Enter internal passphrase: ` )
115
+ . then ( ( passphrase ) => {
116
+ mutableStdout . muted = false ;
117
+ saveAuth ( { internalPass : passphrase } , authStore )
118
+ . then ( resolve )
119
+ . catch ( reject ) ;
120
+ } ) ;
121
+ mutableStdout . muted = true ;
122
+ } ) ;
123
123
} ) ;
124
124
125
125
const options = { } ;
@@ -138,22 +138,22 @@ const parseArgs = () => {
138
138
options . mongo = true ;
139
139
}
140
140
return Promise . resolve ( ) ;
141
- }
141
+ } ;
142
142
143
143
parseArgs ( )
144
- . then ( ( ) => {
145
- if ( options . rabbit ) {
146
- return updateRabbit ( ) ;
147
- }
148
- } )
149
- . then ( ( ) => {
150
- if ( options . mongo ) {
151
- return updateMongo ( ) ;
152
- }
153
- } )
154
- . then ( ( ) => {
155
- if ( options . internal ) {
156
- return updateInternal ( ) ;
157
- }
158
- } )
159
- . finally ( ( ) => readline . close ( ) ) ;
144
+ . then ( ( ) => {
145
+ if ( options . rabbit ) {
146
+ return updateRabbit ( ) ;
147
+ }
148
+ } )
149
+ . then ( ( ) => {
150
+ if ( options . mongo ) {
151
+ return updateMongo ( ) ;
152
+ }
153
+ } )
154
+ . then ( ( ) => {
155
+ if ( options . internal ) {
156
+ return updateInternal ( ) ;
157
+ }
158
+ } )
159
+ . finally ( ( ) => readline . close ( ) ) ;
0 commit comments