File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ import (
1818)
1919
2020func main () {
21+ requiredPasswords := []string {"SU_PASSWORD" , "OPERATOR_PASSWORD" }
22+ for _ , str := range requiredPasswords {
23+ if _ , exists := os .LookupEnv (str ); ! exists {
24+ panic (fmt .Errorf ("%s is required" , str ))
25+ }
26+ }
27+
2128 if _ , err := os .Stat ("/data/postgres" ); os .IsNotExist (err ) {
2229 setDirOwnership ()
2330 initializePostgres ()
@@ -159,8 +166,6 @@ func setDefaultHBA() error {
159166}
160167
161168func createRequiredUsers () error {
162- fmt .Println ("Creating required users" )
163-
164169 node , err := flypg .NewNode ()
165170 if err != nil {
166171 return err
@@ -171,8 +176,6 @@ func createRequiredUsers() error {
171176 return err
172177 }
173178
174- fmt .Printf ("Connection: %+v\n " , conn )
175-
176179 curUsers , err := admin .ListUsers (context .TODO (), conn )
177180 if err != nil {
178181 return errors .Wrap (err , "failed to list current users" )
@@ -207,8 +210,8 @@ func createRequiredUsers() error {
207210 }
208211 }
209212 }
210- return nil
211213
214+ return nil
212215}
213216
214217func PanicHandler (err error ) {
You can’t perform that action at this time.
0 commit comments