mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:07:31 +00:00
fix: initial failures (#4291)
* fix(cmd): read configuration correctly * fix(database): read weakly typed config * fix(database): correct handling of update columns Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -31,16 +31,18 @@ Prereqesits:
|
||||
- cockroachdb with user and database
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
config := new(Config)
|
||||
if err := viper.Unmarshal(config); err != nil {
|
||||
return err
|
||||
}
|
||||
config := MustNewConfig(viper.GetViper())
|
||||
return verifyZitadel(config.Database)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func VerifyZitadel(db *sql.DB, config database.Config) error {
|
||||
err := ReadStmts(config.Type())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := exec(db, fmt.Sprintf(createSystemStmt, config.Username()), nil); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -73,10 +75,12 @@ func VerifyZitadel(db *sql.DB, config database.Config) error {
|
||||
|
||||
func verifyZitadel(config database.Config) error {
|
||||
logging.WithFields("database", config.Database()).Info("verify zitadel")
|
||||
|
||||
db, err := database.Connect(config, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := VerifyZitadel(db, config); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user