Created
September 9, 2015 15:17
-
-
Save bcardarella/0c59378615779263798f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :my_app, :twitter_api, | |
client: Twitter.SandboxClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :my_app, :twitter_api, | |
client: Twitter.TestClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index(conn, %{"username" => username}) do | |
client = Application.get_env(:my_app, :twitter_api)[:client] | |
client.get(username) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes! You can configure it directly too if you prefer:
And in your controller I would move it to a function: