fix(zitadelctl): add repokey parameter to configure command (#2120)

* fix(zitadelctl): add repokey parameter to configure command

* fix(zitadelctl): correct orbos import for failed go vet

* fix: update orbos dependency to merged master

* fix: correct use of the repo key

Co-authored-by: Elio Bischof <eliobischof@gmail.com>

* chore: update orbos

* chore: update orbos

Co-authored-by: Elio Bischof <eliobischof@gmail.com>
This commit is contained in:
Stefan Benz
2021-10-25 18:23:35 +02:00
committed by GitHub
parent 686c0edb5c
commit 476cb6137b
3 changed files with 549 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ func ConfigCommand(getRv GetRootValues, ghClientID, ghClientSecret string) *cobr
var (
newMasterKey string
newRepoURL string
newRepoKey string
cmd = &cobra.Command{
Use: "configure",
Short: "Configures and reconfigures an orb",
@@ -34,10 +35,15 @@ func ConfigCommand(getRv GetRootValues, ghClientID, ghClientSecret string) *cobr
flags := cmd.Flags()
flags.StringVar(&newMasterKey, "masterkey", "", "Reencrypts all secrets")
flags.StringVar(&newRepoURL, "repourl", "", "Configures the repository URL")
flags.StringVar(&newRepoKey, "repokey", "", "Configures the used key to communicate with the repository")
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
rv := getRv("configure", map[string]interface{}{"masterkey": newMasterKey != "", "newRepoURL": newRepoURL}, "")
rv := getRv("configure", map[string]interface{}{
"masterkey": newMasterKey != "",
"newRepoURL": newRepoURL,
"newRepoKey": newRepoKey != "",
}, "")
defer func() {
err = rv.ErrFunc(err)
}()
@@ -46,7 +52,17 @@ func ConfigCommand(getRv GetRootValues, ghClientID, ghClientSecret string) *cobr
return mntr.ToUserError(errors.New("configure command is only supported with the --gitops flag"))
}
if err := orb.Reconfigure(rv.Ctx, rv.Monitor, rv.OrbConfig, newRepoURL, newMasterKey, rv.GitClient, ghClientID, ghClientSecret); err != nil {
if err := orb.Reconfigure(
rv.Ctx,
rv.Monitor,
rv.OrbConfig,
newRepoURL,
newMasterKey,
newRepoKey,
rv.GitClient,
ghClientID,
ghClientSecret,
); err != nil {
return err
}
@@ -69,6 +85,7 @@ func ConfigCommand(getRv GetRootValues, ghClientID, ghClientSecret string) *cobr
rv.GitClient,
rv.OrbConfig.Masterkey,
append(cfg.ORBOSConfigurers(
rv.Ctx,
rv.Monitor,
rv.OrbConfig,
rv.GitClient,