-
Notifications
You must be signed in to change notification settings - Fork 374
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
read project name from env by default #949
Conversation
Weirdly, the failing test passes on my machine 🤔
|
Ah, the tests behave differently when run in isolation vs as part of make test 😵💫
When the tests in I see there's a I'm a little out of my depth, but I think we'll need either:
What's the best way to proceed here? |
Had a chat w/ alan, figured out a solution here. Will update and flag for review. |
r? |
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 add tests for this? Changing the init has potential for a lode of unintended side effects in the future so I wan to make sure this doesn't break
Check out some of the afero fs ones we have floating around, it'll let you use the in memory fs which may be helpful.
@tomer-stripe no problem! We added a couple of basic ones. The change itself is fairly small in scope (I think- feel free to correct), since we're only modifying specific keys. So, we added tests tracking changes to the Let me know if there's anything else you'd like me to cover! |
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.
Overall looks good to me other than when the project name doesn't exist, the error message is a little inaccurate. Any chance we could fix this?
STRIPE_PROJECT_NAME=asdf stripe customers list
You provided the "--project-name" flag, but no config for that project was found. Please run `stripe login --project-name=`..
Sure can! Can you explain a little more what you mean by inaccurate? That's the same message that exists today when you provide a non-existant project in the flag:
What you you rather it say in that situation? |
It's inaccurate in that when I run
|
Oh got it! So maybe a message that is more ambiguous about where the project came from? Like We could also try and suss out how they supplied the project name, but since they both point to the same variable, I'm not sure we could accurately determine how the value was provided. |
That's fair, let's go with your message! |
Sweet. Pushed e3e1063, which improves the message and took it a step further, adding the failed project name in the error message itself:
Let me know what you think! |
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, thanks for making the changes!
Reviewers
r? @
cc @stripe/developer-products
Summary
Fixes #763. Uses viper's
BindEnv
to readSTRIPE_PROJECT_NAME
from the environment, if it exists. We then manually re-bind the env value to theConfig
, if needed.Not sure how to write a unit test for this, but manual testing looks good. Testing using a tweaked version of
config --list
:NOTE This is the first production go code I've written, so extra scrutiny and tips is appreciated!