-
Notifications
You must be signed in to change notification settings - Fork 50
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
chore: Make keyring non-interactive #3026
chore: Make keyring non-interactive #3026
Conversation
b951027
to
a91136a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3026 +/- ##
===========================================
+ Coverage 79.34% 79.36% +0.01%
===========================================
Files 333 333
Lines 25822 25837 +15
===========================================
+ Hits 20488 20503 +15
- Misses 3865 3869 +4
+ Partials 1469 1465 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
might want to also ignore the .env
file in the .gitignore
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.
I like the approach, just had some questions:
question: Where is the loading of the environment variables from '.env' file being done?
question: When you say root
directory what do you mean i.e. what are the paths that this .env
file will be picked from (and the order of priority if many paths)?
question: Have you tested this works when .env
flow?
readPassword = func(_ *cobra.Command, _ string) ([]byte, error) { | ||
return []byte("secret"), nil | ||
} | ||
err := os.Setenv("DEFRA_KEYRING_SECRET", "password") |
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.
question: don't we want to keep at least one test that uses the old prompt?
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.
The prompt has been removed entirely.
b8937c7
to
23745f5
Compare
@shahzadlone, it's done from where Defra is started.
Currently there is only one path and it's
Yes I've tested this manually. |
2216e9c
to
aa381ee
Compare
@shahzadlone I've added a flag to let the user define the path and updated the documentation to say |
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.
A few thoughts and questions but nothing blocking.
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.
LGTM
436738c
to
aab3f33
Compare
Relevant issue(s)
Resolves #2995
Description
This PR makes the keyring interactions non-interactive by requiring the keyring password to be set as an environment variable secret. It also adds support for that secret to be stored in a
.env
file in the working directory or in a file at a path defined by the--secret-file
flag.Making the keyring non-interactive is necessary to support automated deployments.
Tasks
How has this been tested?
make test
Also tested manually starting Defra with a
.env
file to make sure that the secret was picked up.Specify the platform(s) on which this was tested: