File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -126,12 +126,20 @@ export class DatabaseService {
126
126
const userGroups = [ 'everyone' , 'admin' ] ;
127
127
128
128
try {
129
- // Generiere ein zufälliges Passwort
130
- const plainPassword = crypto
131
- . randomBytes ( 25 )
132
- . toString ( 'base64' )
133
- . slice ( 0 , 19 ) ;
134
- // Erstelle einen bcrypt-Hash
129
+ let plainPassword : string ;
130
+
131
+ if ( ! process . env . KUBERO_ADMIN_PASSWORD && process . env . KUBERO_ADMIN_PASSWORD !== '' ) {
132
+ // Generate a random password
133
+ plainPassword = crypto
134
+ . randomBytes ( 25 )
135
+ . toString ( 'base64' )
136
+ . slice ( 0 , 19 ) ;
137
+
138
+ } else {
139
+ plainPassword = process . env . KUBERO_ADMIN_PASSWORD ;
140
+ }
141
+
142
+ // create bcrypt hash
135
143
const passwordHash = await bcrypt . hash ( plainPassword , 10 ) ;
136
144
console . log ( '\n\n\n' , 'Admin account created since no user exists yet' ) ;
137
145
console . log ( ' username: ' , adminUser ) ;
You can’t perform that action at this time.
0 commit comments