mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-10 23:52:16 +00:00
fix(cli): overwrite setups (#3488)
* fix(cli): possibility to overwrite setup steps * chore: update cockroach version in go-dep * fix(cli): init masterkey flags once Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -18,10 +18,11 @@ import (
|
||||
var (
|
||||
//go:embed steps.yaml
|
||||
defaultSteps []byte
|
||||
stepFiles []string
|
||||
)
|
||||
|
||||
func New() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
cmd := &cobra.Command{
|
||||
Use: "setup",
|
||||
Short: "setup ZITADEL instance",
|
||||
Long: `sets up data to start ZITADEL.
|
||||
@@ -37,6 +38,15 @@ Requirements:
|
||||
Setup(config, steps, masterKey)
|
||||
},
|
||||
}
|
||||
|
||||
Flags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func Flags(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringArrayVar(&stepFiles, "steps", nil, "paths to step files to overwrite default steps")
|
||||
key.AddMasterKeyFlag(cmd)
|
||||
}
|
||||
|
||||
func Setup(config *Config, steps *Steps, masterKey string) {
|
||||
@@ -79,3 +89,13 @@ func Setup(config *Config, steps *Steps, masterKey string) {
|
||||
err = migration.Migrate(ctx, eventstoreClient, steps.S3DefaultInstance)
|
||||
logging.OnError(err).Fatal("unable to migrate step 4")
|
||||
}
|
||||
|
||||
func initSteps(v *viper.Viper, files ...string) func() {
|
||||
return func() {
|
||||
for _, file := range files {
|
||||
v.SetConfigFile(file)
|
||||
err := v.MergeInConfig()
|
||||
logging.WithFields("file", file).OnError(err).Warn("unable to read setup file")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user