[erlang-questions] starting an app with an app.config file

Roberto Ostinelli <>
Mon Oct 15 01:32:42 CEST 2012


To extend: I can ensure that app.config is used:


   - when in development mode, by configuring it manually:

erl -pa apps/*/ebin -pa deps/*/ebin \
-boot start_sasl \
-config app \
-s myapp

   - when it is packaged as a release (i believe this can be managed by
   reltool)

But how can I set myapp to use it in common tests?



On Sun, Oct 14, 2012 at 3:56 PM, Roberto Ostinelli <>wrote:

> Dear list,
>
> I have an application set up with the standard structure:
>
> -- myproject
>    rebar.config
>    *app.config*
>    |-- apps
>        |-- myapp
>            |--src
>               ...
>            |--test
>               myapp_SUITE.erl
>    |-- deps
>        |-- dep1
>        |-- dep2
>    |-- ...
>
>
> Please note app.config in there. Everything perfectly fine if I start
> myapp.
>
> However, I'm trying to use Common Tests, and I start myapp in
> myapp_SUITE.erl during init:
>
> init_per_suite(Config) ->
> ok = application:start(myapp),
>  Config.
>
> During startup, myapp tries to access config variables:
>
> {ok, Port} = application:get_env(myapp, port),
>
> This crashes in test, because application:get_env(myapp, port) returns
> undefined. This basically means that myapp does not load app.config.
>
> How can I solve this?
>
> Thank you,
>
> r.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121014/b18de117/attachment.html>


More information about the erlang-questions mailing list