3

I created a project using rebar called "mything". I added lager as a dependency. Now how do I configure lager? I tried adding a "lager" section to "env" in mything.app.src but it doesn't seem to get those settings. I guess I don't know where env settings for dependencies are supposed to go.

Matt
  • 84,419
  • 25
  • 57
  • 67

1 Answers1

4

You need to create config_name.config file which contains list of configurations for each appliaction you want to configure:

[{mything, [...]}, {lager, [...]}].

Then you can pass it to erl using option -config config_name. It's called system configuration and it overrides default environment properties from .app files. In releases it's usually named sys.config.

Resources for you: Configuring an Application and config.

Łukasz Ptaszyński
  • 1,639
  • 1
  • 12
  • 11
  • So where do I put sys.config in a typical rebar setup? I tried it in the root and the src directory, but neither seemed to go into the release when I did "rebar compile generate". – Matt Dec 12 '14 at 19:27
  • @Matt create `rel` directory, get there and run`rebar create-node nodeid=release_name`. You should get typical files for release but it won't work yet. You need to edit `reltool.config` and change `lib_dirs` to `["../../"]`. `sys.config` is located in `files` directory. Now in rebar.config add `{sub_dirs, ["rel"]}`. Now `rebar generate` should work. You should read about [rebar](https://github.com/rebar/rebar/wiki), reltool and common practices. – Łukasz Ptaszyński Dec 12 '14 at 20:12