How Do I Configure an Erlang app in Elixir project?

So I am using an Erlang application in my Elixir app. The Erlang docs say to either “set it up in the environment” or “use a .config” file.

I have installed the app by putting it in my mix file as a dependency and then added it to my application function.

What is the proper way to do this? Can I somehow use my config.exs? Should I do something in my mix.exs or should I just execute the eralng commmand application:set_env somewhere before I use it?

This is what I’m trying to configure.

1 Like

The contents of your config.exs is used to populate the application environment for any OTP applications mentioned in it. You can add the following code there

config :fuse, stats_plugin: :fuse_stats_folsom
6 Likes

perfect so its gonna basically call

application:set_env(x,y,z) for any config :x, y: :z it finds?

1 Like

Pretty much, yes. You can also do

config :foo, [
  key1: value1,
  key2: value2,
  ...
]

which is equivalent to

Application.put_env(:foo, :key1, value1)
Application.put_env(:foo, :key2, value2)
...
4 Likes