@@ -56,7 +56,9 @@ function checkUserNotExists (user) {
56
56
function reportSuccess ( password ) {
57
57
return function ( user ) {
58
58
return new Promise ( function ( resolve , reject ) {
59
- if ( seedOptions . logResults ) console . log ( chalk . bold . red ( 'Database Seeding:\t\t\tLocal ' + user . username + ' added with password set to ' + password ) ) ;
59
+ if ( seedOptions . logResults ) {
60
+ console . log ( chalk . bold . red ( 'Database Seeding:\t\t\tLocal ' + user . username + ' added with password set to ' + password ) ) ;
61
+ }
60
62
resolve ( ) ;
61
63
} ) ;
62
64
} ;
@@ -73,24 +75,24 @@ function seedTheUser (user) {
73
75
74
76
if ( user . username === seedOptions . seedAdmin . username && process . env . NODE_ENV === 'production' ) {
75
77
checkUserNotExists ( user )
76
- . then ( saveUser ( user ) )
77
- . then ( reportSuccess ( password ) )
78
- . then ( function ( ) {
79
- resolve ( ) ;
80
- } )
81
- . catch ( function ( err ) {
82
- reject ( err ) ;
83
- } ) ;
78
+ . then ( saveUser ( user ) )
79
+ . then ( reportSuccess ( password ) )
80
+ . then ( function ( ) {
81
+ resolve ( ) ;
82
+ } )
83
+ . catch ( function ( err ) {
84
+ reject ( err ) ;
85
+ } ) ;
84
86
} else {
85
87
removeUser ( user )
86
- . then ( saveUser ( user ) )
87
- . then ( reportSuccess ( password ) )
88
- . then ( function ( ) {
89
- resolve ( ) ;
90
- } )
91
- . catch ( function ( err ) {
92
- reject ( err ) ;
93
- } ) ;
88
+ . then ( saveUser ( user ) )
89
+ . then ( reportSuccess ( password ) )
90
+ . then ( function ( ) {
91
+ resolve ( ) ;
92
+ } )
93
+ . catch ( function ( err ) {
94
+ reject ( err ) ;
95
+ } ) ;
94
96
}
95
97
} ) ;
96
98
} ;
@@ -135,22 +137,22 @@ module.exports.start = function start(options) {
135
137
//If production only seed admin if it does not exist
136
138
if ( process . env . NODE_ENV === 'production' ) {
137
139
User . generateRandomPassphrase ( )
138
- . then ( seedTheUser ( adminAccount ) )
139
- . then ( function ( ) {
140
+ . then ( seedTheUser ( adminAccount ) )
141
+ . then ( function ( ) {
140
142
resolve ( ) ;
141
143
} )
142
- . catch ( reportError ( reject ) ) ;
144
+ . catch ( reportError ( reject ) ) ;
143
145
} else {
144
146
// Add both Admin and User account
145
147
146
148
User . generateRandomPassphrase ( )
147
- . then ( seedTheUser ( userAccount ) )
148
- . then ( User . generateRandomPassphrase )
149
- . then ( seedTheUser ( adminAccount ) )
150
- . then ( function ( ) {
149
+ . then ( seedTheUser ( userAccount ) )
150
+ . then ( User . generateRandomPassphrase )
151
+ . then ( seedTheUser ( adminAccount ) )
152
+ . then ( function ( ) {
151
153
resolve ( ) ;
152
154
} )
153
- . catch ( reportError ( reject ) ) ;
155
+ . catch ( reportError ( reject ) ) ;
154
156
}
155
157
} ) ;
156
158
} ;
0 commit comments