mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-04 15:35:10 +00:00
fix(mirror): read config correctly (#8330)
# Which Problems Are Solved The mirror command read the configurations in the wrong order # How the Problems Are Solved The Pre execution run of `mirror` reads the default config first and then applies the custom configs
This commit is contained in:
parent
b3a60863f5
commit
0ea3c5691f
@ -18,7 +18,7 @@ var (
|
||||
shouldReplace bool
|
||||
)
|
||||
|
||||
func New() *cobra.Command {
|
||||
func New(configFiles *[]string) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "mirror",
|
||||
Short: "mirrors all data of ZITADEL from one database to another",
|
||||
@ -37,6 +37,12 @@ Order of execution:
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
err := viper.MergeConfig(bytes.NewBuffer(defaultConfig))
|
||||
logging.OnError(err).Fatal("unable to read default config")
|
||||
|
||||
for _, file := range *configFiles {
|
||||
viper.SetConfigFile(file)
|
||||
err := viper.MergeInConfig()
|
||||
logging.WithFields("file", file).OnError(err).Warn("unable to read config file")
|
||||
}
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
config := mustNewMigrationConfig(viper.GetViper())
|
||||
|
@ -56,7 +56,7 @@ func New(out io.Writer, in io.Reader, args []string, server chan<- *start.Server
|
||||
start.New(server),
|
||||
start.NewStartFromInit(server),
|
||||
start.NewStartFromSetup(server),
|
||||
mirror.New(),
|
||||
mirror.New(&configFiles),
|
||||
key.New(),
|
||||
ready.New(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user