Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
starting an app with an app.config file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Roberto Ostinelli  
View profile  
 More options Oct 14 2012, 6:56 pm
From: Roberto Ostinelli <robe...@widetag.com>
Date: Sun, 14 Oct 2012 15:56:03 -0700
Local: Sun, Oct 14 2012 6:56 pm
Subject: [erlang-questions] starting an app with an app.config file

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-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto Ostinelli  
View profile  
 More options Oct 14 2012, 7:32 pm
From: Roberto Ostinelli <robe...@widetag.com>
Date: Sun, 14 Oct 2012 16:32:42 -0700
Local: Sun, Oct 14 2012 7:32 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

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 <robe...@widetag.com>wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Gopienko  
View profile  
 More options Oct 15 2012, 1:40 am
From: Andrew Gopienko <gopie...@gmail.com>
Date: Mon, 15 Oct 2012 12:40:24 +0700
Local: Mon, Oct 15 2012 1:40 am
Subject: Re: [erlang-questions] starting an app with an app.config file

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 <robe...@widetag.com>

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto Ostinelli  
View profile  
 More options Oct 15 2012, 2:09 am
From: Roberto Ostinelli <robe...@widetag.com>
Date: Sun, 14 Oct 2012 23:09:40 -0700
Local: Mon, Oct 15 2012 2:09 am
Subject: Re: [erlang-questions] starting an app with an app.config file

What has this to do with my question?

My question is how can I use the same app.config file when I start an
application from Common Tests.

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Gopienko  
View profile  
 More options Oct 15 2012, 4:53 am
From: Andrew Gopienko <gopie...@gmail.com>
Date: Mon, 15 Oct 2012 15:52:55 +0700
Local: Mon, Oct 15 2012 4:52 am
Subject: Re: [erlang-questions] starting an app with an app.config file

Just read your config file and set env with application:load before
application:start

2012/10/15 Roberto Ostinelli <robe...@widetag.com>

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto Ostinelli  
View profile  
 More options Oct 15 2012, 4:33 pm
From: Roberto Ostinelli <robe...@widetag.com>
Date: Mon, 15 Oct 2012 13:32:56 -0700
Local: Mon, Oct 15 2012 4:32 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

Oh I understand now.

Thank you Andrew, will try that.

r.

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto Ostinelli  
View profile  
 More options Oct 20 2012, 5:00 pm
From: Roberto Ostinelli <robe...@widetag.com>
Date: Sat, 20 Oct 2012 14:00:36 -0700
Local: Sat, Oct 20 2012 5:00 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

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 <gopie...@gmail.com>wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesse Gumm  
View profile  
 More options Oct 20 2012, 5:48 pm
From: Jesse Gumm <g...@sigma-star.com>
Date: Sat, 20 Oct 2012 16:48:42 -0500
Local: Sat, Oct 20 2012 5:48 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

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" <robe...@widetag.com> wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Motiejus Jakštys  
View profile  
 More options Oct 20 2012, 6:46 pm
From: Motiejus Jakštys <desired....@gmail.com>
Date: Sat, 20 Oct 2012 23:45:49 +0100
Local: Sat, Oct 20 2012 6:45 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

On Sat, Oct 20, 2012 at 10:00 PM, Roberto Ostinelli <robe...@widetag.com> 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?

    {ok, Config} = file:consult(File),
    [application:set_env(myapp, K, V) | {K, V} <- Config].

Not tested.

Config might have to be [Config], you should try this out.

--
Motiejus Jakštys
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto Ostinelli  
View profile  
 More options Oct 20 2012, 8:00 pm
From: Roberto Ostinelli <robe...@widetag.com>
Date: Sat, 20 Oct 2012 17:00:50 -0700
Local: Sat, Oct 20 2012 8:00 pm
Subject: Re: [erlang-questions] starting an app with an app.config file

Hi Motiejus,

I'm doing something similar. It just feels weird. (:

r.

On Sat, Oct 20, 2012 at 3:45 PM, Motiejus Jakštys <desired....@gmail.com>wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phillip Toland  
View profile  
 More options Oct 22 2012, 2:37 pm
From: Phillip Toland <phil.tol...@gmail.com>
Date: Mon, 22 Oct 2012 13:36:49 -0500
Local: Mon, Oct 22 2012 2:36 pm
Subject: Re: [erlang-questions] starting an app with an app.config file
If you put an app.config file into the test directory, rebar will pick
it up. If you don't want to have two app.config files, then you can
use the ct_extra_params option in rebar.config. The value of that
option will be passed on the command line of the beam process that
runs the tests, so you could pass in something like "-config
app.config" and have it use the existing config file.

~p

--
~p
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »