[erlang-questions] starting an app with an app.config file
Jesse Gumm
gumm@REDACTED
Sat Oct 20 23:48:42 CEST 2012
Hi Roberto,
What about adding the app(s) to your appname.rel script in release/x.y.z
and then using systools:make_script to generate the boot script.
That seems to work for me, anyway
-Jesse
--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm
On Oct 20, 2012 4:00 PM, "Roberto Ostinelli" <roberto@REDACTED> wrote:
> 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 <gopienko@REDACTED>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 <roberto@REDACTED>
>>
>>> 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 <roberto@REDACTED>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
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121020/f97986ff/attachment.htm>
More information about the erlang-questions
mailing list