@@ -13,8 +13,7 @@ class ConfigCommand extends Command {
13
13
constructor ( ui , system ) {
14
14
super ( ui , system ) ;
15
15
16
- let instance = this . system . getInstance ( ) ;
17
- this . config = instance . config ;
16
+ this . instance = this . system . getInstance ( ) ;
18
17
}
19
18
20
19
handleAdvancedOptions ( argv ) {
@@ -29,11 +28,11 @@ class ConfigCommand extends Command {
29
28
}
30
29
31
30
let defaultValue = isFunction ( option . defaultValue ) ?
32
- option . defaultValue ( this . config , this . system . environment ) :
31
+ option . defaultValue ( this . instance . config , this . system . environment ) :
33
32
option . defaultValue ;
34
33
35
34
return Promise . resolve ( defaultValue ) . then ( ( result ) => {
36
- this . config . set ( configKey , result ) ;
35
+ this . instance . config . set ( configKey , result ) ;
37
36
} ) ;
38
37
}
39
38
@@ -47,7 +46,7 @@ class ConfigCommand extends Command {
47
46
} ) ) ;
48
47
}
49
48
50
- this . config . set ( configKey , value ) ;
49
+ this . instance . config . set ( configKey , value ) ;
51
50
} ) ;
52
51
} ) . then ( ( ) => {
53
52
// Because the 'port' option can end up being different than the one supplied
@@ -59,10 +58,10 @@ class ConfigCommand extends Command {
59
58
// url.format won't take the new port unless 'parsedUrl.host' is undefined
60
59
delete parsedUrl . host ;
61
60
62
- this . config . set ( 'url' , url . format ( parsedUrl ) ) ;
61
+ this . instance . config . set ( 'url' , url . format ( parsedUrl ) ) ;
63
62
}
64
63
65
- this . config . save ( ) ;
64
+ this . instance . config . save ( ) ;
66
65
} ) ;
67
66
}
68
67
@@ -101,17 +100,19 @@ class ConfigCommand extends Command {
101
100
} ] ;
102
101
103
102
if ( key && ! value ) {
103
+ this . instance . checkEnvironment ( ) ;
104
104
// getter
105
- value = this . config . get ( key , null ) ;
105
+ value = this . instance . config . get ( key , null ) ;
106
106
107
107
if ( value ) {
108
108
this . ui . log ( value ) ;
109
109
}
110
110
111
111
return Promise . resolve ( ) ;
112
112
} else if ( key ) {
113
+ this . instance . checkEnvironment ( ) ;
113
114
// setter
114
- this . config . set ( key , value ) . save ( ) ;
115
+ this . instance . config . set ( key , value ) . save ( ) ;
115
116
return Promise . resolve ( ) ;
116
117
}
117
118
0 commit comments