pprzetacznik / IElixir

Jupyter's kernel for Elixir programming language
Apache License 2.0
359 stars 42 forks source link

Pass config files #38

Open ghost opened 6 years ago

ghost commented 6 years ago

I guess this is more of a feature request than a but. For modules that require a config (e.g. those that do API calls), how to pass those configurations?

I tried to include a config file manually in my env, and also tried adding the config directly in the notebook, but it doesn't seem to be a supported feature.

pprzetacznik commented 6 years ago

@rparcus could you give me some examples of such modules where external config file is needed? That would give me bigger insight into that problem.

ghost commented 6 years ago

A few examples would be https://hex.pm/packages/extwitter or https://hex.pm/packages/ex_twilio which require a config file to set the API keys.

pprzetacznik commented 5 years ago

@rparcus from what I understand you can easily run Jupyter with installed IElixir in it with following line:

$ TWITTER_CONSUMER_KEY=MYCONSUMERKEY101 TWITTER_CONSUMER_SECRET=MYSECRETKEY101 jupyter notebook

and after that you can configure your ExTwitter in the Jupyter notebook by evaluating:

ExTwitter.configure(
  consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
  consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET"),
  access_token: access_token.oauth_token,
  access_token_secret: access_token.oauth_token_secret
)

You can always grab your environment variables set in bash using System.get_env/1 function.

Sorry for not answering the question for so long time.