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

Allow use of ENV variables for public/private keys #82

Closed
joryhatton opened this issue May 18, 2019 · 3 comments
Closed

Allow use of ENV variables for public/private keys #82

joryhatton opened this issue May 18, 2019 · 3 comments

Comments

@joryhatton
Copy link

joryhatton commented May 18, 2019

I'd like to store these values in environment variables instead of checking them into the repository. Is this possible with an alternative configuration method?

defaults: &defaults                                                              
  public_key: <%= ENV["UPLOADCARE_PUBLIC_KEY"] %>                                
  private_key: <%= ENV["UPLOADCARE_PRIVATE_KEY"] %> 

Just blows up.

@dmitry-mukhin
Copy link
Member

what do you mean by blows up?

@joryhatton
Copy link
Author

Private or public key options were not provided (ArgumentError)

I was able to get this working by providing a fallback string in config/uploadcare.yml. ENV vars load successfully, and it prevents the exception during initialization.

defaults: &defaults                                                              
  public_key: <%= ENV["UPLOADCARE_PUBLIC_KEY"] || 'asdf' %>                                
  private_key: <%= ENV["UPLOADCARE_PRIVATE_KEY"] || 'asdf' %>

@dmitrijivanchenko
Copy link
Contributor

@joryhatton, we have released a new 2.0.0 version. We moved keys settings to initializers, so you should be able to set them properly in v2.

❗ See migration guide, v2 is not backward compatible with v1

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

No branches or pull requests

4 participants