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

Roberto Ostinelli <>
Sat Oct 20 23:00:36 CEST 2012


Hi,

this isn't working. From the docs:

load(AppDescr) -> ok | {error, Reason}
load(AppDescr, Distributed) -> ok | {error, Reason}

So application:load/2 actually is not reading from a config file.

Any other ideas?

r.


On Sun, Oct 14, 2012 at 10:40 PM, Andrew Gopienko <>wrote:

> From my eunit tests
>
>     SaslSpec = [{errlog_type, error}],
>     case application:load({application,sasl,SaslSpec}) of
>   {error,{already_loaded,_}} -> ok;
>   ok ->
>       ok = application:start(sasl),
>
>
>
> 2012/10/15 Roberto Ostinelli <>
>
>> 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.
>>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121020/12946bff/attachment.html>


More information about the erlang-questions mailing list