Skip to content

Commit

Permalink
error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamvernekar committed Nov 3, 2023
1 parent cfc1a86 commit a40b9a9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Client struct {
prefix string
ctx context.Context //nolint:containedctx
log zerolog.Logger
KeyFile string
keyFile string
}

type EncryptedConfig struct {
Expand Down Expand Up @@ -78,6 +78,10 @@ func (c *Client) GetOrgPublicKeys(env string) (OrgPublicKeys, error) {
return OrgPublicKeys{Recipients: recps}, nil
}

func (c *Client) GetKeyFile() string {
return c.keyFile
}

func New(ctx context.Context, cfg config.Client) (*Client, error) {
if err := cfg.Valid(); err != nil {
return nil, err
Expand All @@ -93,7 +97,7 @@ func New(ctx context.Context, cfg config.Client) (*Client, error) {
bucket: cfg.BucketName(),
prefix: cfg.StoragePrefix,
log: log.With().Str("bucket", cfg.BucketName()).Str("prefix", cfg.StoragePrefix).Logger(),
KeyFile: cfg.KeyFile(),
keyFile: cfg.KeyFile(),
}
return cli, nil
}
4 changes: 4 additions & 0 deletions client/monart.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func (s MonartClient) call(req *http.Request, dest any) (*http.Response, error)
return resp, nil
}

func (s MonartClient) GetKeyFile() string {
return ""
}

func NewMonart(ctx context.Context, cfg *config.Monart) MonartClient {
cred := credentials{APIToken: cfg.APIToken, ID: cfg.ID}
return MonartClient{cli: http.DefaultClient, cred: cred, ctx: ctx}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dolores/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewConfig(client GetClient) *ConfigCommand {
func (c *ConfigCommand) editAction(ctx *cli.Context) error {
rcli := c.rcli(ctx.Context)
env := ctx.String("environment")
ctx.Set("key-file", rcli.KeyFile)
ctx.Set("key-file", rcli.GetKeyFile())
log := c.log.With().Str("cmd", "config.edit").Str("environment", env).Logger()
dcfg, err := parseDecryptConfig(ctx)
if err != nil {
Expand Down Expand Up @@ -68,7 +68,7 @@ func (c *ConfigCommand) encryptAction(ctx *cli.Context) error {
func (c *ConfigCommand) decryptAction(ctx *cli.Context) error {
rcli := c.rcli(ctx.Context)

ctx.Set("key-file", rcli.KeyFile)
ctx.Set("key-file", rcli.GetKeyFile())
req, err := parseDecryptConfig(ctx)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions cmd/dolores/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type secretsClient interface {
FetchSecrets(req client.FetchSecretRequest) ([]byte, error)
GetOrgPublicKeys(env string) (client.OrgPublicKeys, error)
Init(ctx context.Context, bucket string, cfg client.Configuration) error
GetKeyFile() string
}

type CtxKey string
Expand Down

0 comments on commit a40b9a9

Please sign in to comment.