-
Notifications
You must be signed in to change notification settings - Fork 248
[secrets] Implement ls, set, rm secrets #1713
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat!
cmd.AddCommand(secretsSetCmd(flags)) | ||
cmd.Hidden = true | ||
|
||
flags.config.registerPersistent(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update the envsec
wording to secrets
in:
https://github.com/jetpack-io/devbox/blob/11bb6f05a4562d16ee572e54a11c13a6c9943346/internal/boxcli/config.go#L21-L30
internal/boxcli/secrets.go
Outdated
cmd := &cobra.Command{ | ||
Use: "secrets", | ||
Aliases: []string{"envsec"}, | ||
Short: "Interact with devbox secrets.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of ...devbox secrets
should it be Interact with secrets in jetpack cloud
?
return &cobra.Command{ | ||
Use: "set <NAME1>=<value1> [<NAME2>=<value2>]...", | ||
Short: "Securely store one or more environment variables", | ||
Long: "Securely store one or more environment variables. To test contents of a file as a secret use set=@<file>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you test the file-upload scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works!
internal/boxcli/secrets.go
Outdated
"show", | ||
"s", | ||
false, | ||
"Display the value of each environment variable (secrets included)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels odd to mention environment variable
when the command is devbox secrets
.
Can this be: Display the value of the secret [default = false]
?
internal/boxcli/secrets.go
Outdated
"format", | ||
"f", | ||
"table", | ||
"Display the key values in key=value format. Must be one of: table | dotenv | json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Display the key values of each secret in the specified format, one of: table | dotenv | json. [default = table]"
?
internal/devbox/devbox.go
Outdated
} | ||
} | ||
} else if d.cfg.EnvFrom != "" { | ||
return nil, usererr.New("unknown from_env value: %s", d.cfg.EnvFrom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usererr.New("unknown from_env value: %s. Supported value is: envsec.", d.cfg.EnvFrom, )
internal/devbox/devbox.go
Outdated
func (d *Devbox) Environment() string { | ||
return d.environment | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be made visible externally? Seems like its used in internal/devbox/secrets.go
which can use d.environment
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Summary
Implements
secrets list
,secrets set
, andsecrets rm
.Removed dependency on envsec binary.
Renamed
envsec
commands tosecrets
TODO: Improve envsec interface to avoid having to use embedded struct.
How was it tested?