mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 19:47:23 +00:00
fix(cli): no more panics during startup (#4333)
* fix(cli): configure id generator * fix(cli): use correct viper environment
This commit is contained in:
parent
1e8d7e34fa
commit
f71d158fb0
@ -24,5 +24,7 @@ func MustNewConfig(v *viper.Viper) *Config {
|
|||||||
err = config.Log.SetLogger()
|
err = config.Log.SetLogger()
|
||||||
logging.OnError(err).Fatal("unable to set logger")
|
logging.OnError(err).Fatal("unable to set logger")
|
||||||
|
|
||||||
|
id.Configure(config.Machine)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/zitadel/logging"
|
"github.com/zitadel/logging"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/database"
|
"github.com/zitadel/zitadel/internal/database"
|
||||||
"github.com/zitadel/zitadel/internal/id"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -58,8 +57,6 @@ The user provided by flags needs privileges to
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InitAll(config *Config) {
|
func InitAll(config *Config) {
|
||||||
id.Configure(config.Machine)
|
|
||||||
|
|
||||||
err := initialise(config.Database,
|
err := initialise(config.Database,
|
||||||
VerifyUser(config.Database.Username(), config.Database.Password()),
|
VerifyUser(config.Database.Username(), config.Database.Password()),
|
||||||
VerifyDatabase(config.Database.Database()),
|
VerifyDatabase(config.Database.Database()),
|
||||||
|
@ -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
|
- grant all rights of the ZITADEL database to the user created if not yet set
|
||||||
`,
|
`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
config := MustNewConfig(viper.New())
|
config := MustNewConfig(viper.GetViper())
|
||||||
|
|
||||||
err := initialise(config.Database, VerifyDatabase(config.Database.Database()))
|
err := initialise(config.Database, VerifyDatabase(config.Database.Database()))
|
||||||
logging.OnError(err).Fatal("unable to initialize the database")
|
logging.OnError(err).Fatal("unable to initialize the database")
|
||||||
|
@ -20,7 +20,7 @@ Prereqesits:
|
|||||||
- cockroachDB or postgreSQL
|
- cockroachDB or postgreSQL
|
||||||
`,
|
`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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()))
|
err := initialise(config.Database, VerifyGrant(config.Database.Database(), config.Database.Username()))
|
||||||
logging.OnError(err).Fatal("unable to set grant")
|
logging.OnError(err).Fatal("unable to set grant")
|
||||||
|
@ -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
|
- grant all rights of the ZITADEL database to the user created if not yet set
|
||||||
`,
|
`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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()))
|
err := initialise(config.Database, VerifyUser(config.Database.Username(), config.Database.Password()))
|
||||||
logging.OnError(err).Fatal("unable to init user")
|
logging.OnError(err).Fatal("unable to init user")
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
"github.com/zitadel/zitadel/internal/database"
|
"github.com/zitadel/zitadel/internal/database"
|
||||||
|
"github.com/zitadel/zitadel/internal/id"
|
||||||
"github.com/zitadel/zitadel/internal/query/projection"
|
"github.com/zitadel/zitadel/internal/query/projection"
|
||||||
static_config "github.com/zitadel/zitadel/internal/static/config"
|
static_config "github.com/zitadel/zitadel/internal/static/config"
|
||||||
metrics "github.com/zitadel/zitadel/internal/telemetry/metrics/config"
|
metrics "github.com/zitadel/zitadel/internal/telemetry/metrics/config"
|
||||||
@ -54,6 +55,7 @@ type Config struct {
|
|||||||
AuditLogRetention time.Duration
|
AuditLogRetention time.Duration
|
||||||
SystemAPIUsers map[string]*internal_authz.SystemAPIUser
|
SystemAPIUsers map[string]*internal_authz.SystemAPIUser
|
||||||
CustomerPortal string
|
CustomerPortal string
|
||||||
|
Machine *id.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustNewConfig(v *viper.Viper) *Config {
|
func MustNewConfig(v *viper.Viper) *Config {
|
||||||
@ -79,6 +81,8 @@ func MustNewConfig(v *viper.Viper) *Config {
|
|||||||
err = config.Metrics.NewMeter()
|
err = config.Metrics.NewMeter()
|
||||||
logging.OnError(err).Fatal("unable to set meter")
|
logging.OnError(err).Fatal("unable to set meter")
|
||||||
|
|
||||||
|
id.Configure(config.Machine)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user