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

Configure accound_sid and auth_token in run time #65

Closed
gliush opened this issue Jan 13, 2017 · 3 comments
Closed

Configure accound_sid and auth_token in run time #65

gliush opened this issue Jan 13, 2017 · 3 comments

Comments

@gliush
Copy link
Contributor

gliush commented Jan 13, 2017

Hi.

I've tried to use ex_twilio as you specify in documentation and found out the following problem:

  1. Do not define account_sid & auth_token during the build step
  2. Build application
  3. Define account_sid and auth_token
  4. Run application.
  5. Get an error (because account_sid and auth_token is undefined)

It seems that all the configurations are compiled into the binaries and any changes to the configuration in runtime doesn't influence it.

I'm strongly against this approach, as we should have different binaries for the dev and for production, we should have access to the production secrets on our building machine, etc.

If you need more details how I'm doing this - don't hesitate to ask.

PS:
If I'm doing smth wrong and there's a workaround - could you explain it please.

@danielberkompas
Copy link
Owner

danielberkompas commented Jan 13, 2017

This is a common issue with many hex packages. The solution is to enable this syntax for configuration:

config :ex_twilio, account_sid: {:system, "ACCOUNT_SID"}

When you do it the way ExTwilio currently does, the System.get_env/2 calls happen at compile time rather than runtime.

It shouldn't take me too long to add this syntax once I can get around to it.

@gliush
Copy link
Contributor Author

gliush commented Jan 14, 2017

Do you need help in this?
I can't use current version and currently I'm writing a small library for the functions that I need.

danielberkompas added a commit that referenced this issue Jan 14, 2017
See the updated config files and README.

Closes #65.
danielberkompas added a commit that referenced this issue Jan 14, 2017
[#65] Allow runtime config with {:system} tuples
@danielberkompas
Copy link
Owner

@gliush I've added the ability to configure at runtime. A new release will coming shortly, in the meantime you can depend on the git repo.

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