Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract config logic into own package #743

Merged
merged 12 commits into from
Apr 19, 2023
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ require (
github.com/stretchr/testify v1.8.2
github.com/tidwall/pretty v1.2.1
github.com/zalando/go-keyring v0.2.2
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/oauth2 v0.7.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.7.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func openActionCmd(cli *cli) *cobra.Command {
inputs.ID = args[0]
}

openManageURL(cli, cli.config.DefaultTenant, formatActionDetailsPath(url.PathEscape(inputs.ID)))
openManageURL(cli, cli.Config.DefaultTenant, formatActionDetailsPath(url.PathEscape(inputs.ID)))
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func openAPICmd(cli *cli) *cobra.Command {
}
}

openManageURL(cli, cli.config.DefaultTenant, formatAPISettingsPath(inputs.ID))
openManageURL(cli, cli.Config.DefaultTenant, formatAPISettingsPath(inputs.ID))
return nil
},
}
Expand Down
8 changes: 4 additions & 4 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func useAppCmd(cli *cli) *cobra.Command {
}
}

if err := cli.setDefaultAppID(inputs.ID); err != nil {
if err := cli.Config.SetDefaultAppIDForTenant(cli.tenant, inputs.ID); err != nil {
return err
}

Expand Down Expand Up @@ -479,7 +479,7 @@ func createAppCmd(cli *cli) *cobra.Command {
return fmt.Errorf("Unable to create application: %v", err)
}

if err := cli.setDefaultAppID(a.GetClientID()); err != nil {
if err := cli.Config.SetDefaultAppIDForTenant(cli.tenant, a.GetClientID()); err != nil {
return err
}

Expand Down Expand Up @@ -737,7 +737,7 @@ func openAppCmd(cli *cli) *cobra.Command {
inputs.ID = args[0]
}

openManageURL(cli, cli.config.DefaultTenant, formatAppSettingsPath(inputs.ID))
openManageURL(cli, cli.Config.DefaultTenant, formatAppSettingsPath(inputs.ID))
return nil
},
}
Expand Down Expand Up @@ -879,7 +879,7 @@ func (c *cli) appPickerOptions(requestOpts ...management.RequestOption) pickerOp
return nil, err
}

tenant, err := c.getTenant()
tenant, err := c.Config.GetTenant(c.tenant)
if err != nil {
return nil, err
}
Expand Down
Loading