Skip to content
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

Question about API keys #23

Open
chuckurbis opened this issue May 15, 2024 · 5 comments
Open

Question about API keys #23

chuckurbis opened this issue May 15, 2024 · 5 comments

Comments

@chuckurbis
Copy link

Is there a way to have the library load email and API key from a specific location? Right now I'm having to type in those credentials from the command line, which is inconvenient. Ideally it could read from a .env file.

Also, i noticed it is deleting my ~/.netrc file after I fail in an attempt to deploy. Is this the intended behavior? It is forcing me to re-login to heroku for other apps I use the heroku CLI with.

Thanks for any guidance!

@getlarge
Copy link
Owner

Currently, both values are resolved from the options passed to the executors/generator options as you can see in the schema.
They default to the environment variables:

  • HEROKU_API_KEY
  • HEROKU_EMAIL

Yes, deleting the ~/.netrc file was intended and worked fine in the use cases I encountered, where I wanted to avoid inadvertently using the same credentials used for deployment during development.
I understand it can be troublesome in your use case. This behavior could be configurable via the options to avoid deleting the ~/.netrc.
To extend that logic, we could resolve the email and API key from an existing ~/.netrc file and ignore the email and apiKey options from the executor.
Could that work?

@chuckurbis
Copy link
Author

I haven't had a chance to dive into your code. But I was wondering if we could specify a location for a file with the credentials? Or even just specify where to look for the file.

@getlarge
Copy link
Owner

I consider this idea, but it should be a more specific requirement.
You meant location to a .env file containing HEROKU_API_KEY and HEROKU_EMAIL?
It could work, but updating the .netrc file will still be required.

@chuckurbis
Copy link
Author

Got it. That's probably okay then. I didn't realize it needed to pull from the .netrc file. I think it would be best to at least have the option to use the existing netrc file.

@getlarge
Copy link
Owner

Okay, so we could have a useNetrcFile (boolean) option, and when set to true we would ignore the email and apiKey options.
We would probably need to parse the .netrc to load

  • the API key - which is needed when pushing to Heroku Git using HTTPS protocol.
  • the email - to set the Git user email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants