[erlang-questions] Why application:start can not accept any args?

Nuku Ameyibor nayibor@REDACTED
Mon Jul 13 12:39:34 CEST 2015

u can add environmental variables for your application in  your .app file  .
there is a tuple with a key env which u can use to add environmental
variables to your application which you can then access from your
eg .
{application, test,
 [{vsn, "1.0.0"},
  {description, "testing"},
  {modules, [test, test_sup,test_start]},
  {applications, [stdlib, kernel, crypto]},
  {registered, [test,test_sup]},
  {mod, {test, []}},

you can access them like so
{ok, Env} = application:get_env(env1), etc..

there is also a set_env/3 ,set_env/4 which can be used to change
environmental variables during run-time

On Sun, Jul 12, 2015 at 1:19 PM, Lihe Wang <wanglihe.programmer@REDACTED>

> Can any one give the explain about OTP? The application behaviour's call
> back "start" need args, but when I want start my code as a real
> application, I only can write "applicaion:start(mycode)", and can not pass
> any args to mycode. Why otp design like this? When I want start a
> application as background service from escript, for example:
> main([Arg1, Arg2, Arg3]) ->
>     application:start(mycode1), %%with Arg1
>     application:start(mycode2),  %%with Arg2
>     workcode(Arg3). %%workcode (escript) will run as a daemon, and need
> service supplied by mycode1 and mycode2.
> What is the right way to write these code?
> _______________________________________________
> 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/20150713/0f572f93/attachment.htm>

More information about the erlang-questions mailing list