Skip to content

[envsec] Add (hidden) envsec init command #1678

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

Merged
merged 4 commits into from
Dec 11, 2023
Merged

Conversation

mikeland73
Copy link
Contributor

Summary

TSIA

How was it tested?

devbox envsec init

@mikeland73 mikeland73 requested review from loreto and savil December 8, 2023 18:58
Comment on lines 52 to 57
box.Config().SetStringField("EnvFrom", "envsec")
if err := box.Config().SaveTo(box.ProjectDir()); err != nil {
return errors.WithStack(err)
}

return envsec.EnsureInitialized(cmd.Context(), box.ProjectDir())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we swap the order of envsec.EnsureInitialized and modifying the devbox.json?

i.e. I feel we should only modify the devbox.json once we know envsec has been properly initialized.

@@ -18,7 +18,8 @@ func (c *Config) ComputedEnv(
if c.IsEnvsecEnabled() {
env, err = envsec.Env(ctx, projectDir)
if err != nil {
fmt.Fprintf(os.Stderr, "Error reading secrets from envsec: %s\n\n", err)
ux.Ferror(os.Stderr, "Error reading secrets from envsec: %s\n\n", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are continuing on, should this be a ux.Fwarning instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. something like:

ux.Fwarning(os.Stderr, "Computing Devbox environment without envsec secrets. There was an error from envsec: %s\n\n", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll can switch to warning. My motivation is that it's a fairly big error (not really a warning) so I wanted to make sure it's clear. But generally we don't use errors for commands that end in success.

@mikeland73 mikeland73 merged commit 9f2b788 into main Dec 11, 2023
@mikeland73 mikeland73 deleted the landau/envsec-init branch December 11, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants