fix(cli): no more panics during startup (#4333)

* fix(cli): configure id generator

* fix(cli): use correct viper environment
This commit is contained in:
Silvan
2022-09-07 10:35:12 +02:00
committed by GitHub
parent 1e8d7e34fa
commit f71d158fb0
6 changed files with 9 additions and 6 deletions

View File

@@ -24,5 +24,7 @@ func MustNewConfig(v *viper.Viper) *Config {
err = config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
id.Configure(config.Machine)
return config
}

View File

@@ -9,7 +9,6 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/database"
"github.com/zitadel/zitadel/internal/id"
)
var (
@@ -58,8 +57,6 @@ The user provided by flags needs privileges to
}
func InitAll(config *Config) {
id.Configure(config.Machine)
err := initialise(config.Database,
VerifyUser(config.Database.Username(), config.Database.Password()),
VerifyDatabase(config.Database.Database()),

View File

@@ -25,7 +25,7 @@ The user provided by flags needs priviledge to
- grant all rights of the ZITADEL database to the user created if not yet set
`,
Run: func(cmd *cobra.Command, args []string) {
config := MustNewConfig(viper.New())
config := MustNewConfig(viper.GetViper())
err := initialise(config.Database, VerifyDatabase(config.Database.Database()))
logging.OnError(err).Fatal("unable to initialize the database")

View File

@@ -20,7 +20,7 @@ Prereqesits:
- cockroachDB or postgreSQL
`,
Run: func(cmd *cobra.Command, args []string) {
config := MustNewConfig(viper.New())
config := MustNewConfig(viper.GetViper())
err := initialise(config.Database, VerifyGrant(config.Database.Database(), config.Database.Username()))
logging.OnError(err).Fatal("unable to set grant")

View File

@@ -25,7 +25,7 @@ The user provided by flags needs priviledge to
- grant all rights of the ZITADEL database to the user created if not yet set
`,
Run: func(cmd *cobra.Command, args []string) {
config := MustNewConfig(viper.New())
config := MustNewConfig(viper.GetViper())
err := initialise(config.Database, VerifyUser(config.Database.Username(), config.Database.Password()))
logging.OnError(err).Fatal("unable to init user")