Erlang/OTP Forums

Author Message

<  Open Telecom Platform (OTP)  ~  Passing parameters to a node upon startup

jacek99
Posted: Fri Jun 05, 2009 1:35 pm Reply with quote
User Joined: 26 May 2009 Posts: 27 Location: Montreal, Canada
In our node we're running an embedded instance of YAWS that handles incoming SOAP requests and logs the relevant details in Mnesia.

In our unit tests, we want to be able to test running a whole cluster of these nodes, each YAWS instance listening on a different port (that I want to pass in from the command line as an argument).

So, what is the best way to pass command line args to an OTP app?

I see a few options:

a) just pass using the "erl --" syntax and then get the values using init:get_arguments

b) passing it to the applications's standard start() method:

start(_Type, StartupArguments) ->

In this case, how do I populate the value of StartupArguments from command line?

c) using the "-config" switch.

I discovered this by mistake...erl threw me a an error stating it could not find a corresponding .conf file.

I was not able to find any docs on this or how the .conf file should look like.

Thanks for any suggestions/best practices, etc.
View user's profile Send private message
Mazen
Posted: Fri Jun 05, 2009 5:19 pm Reply with quote
User Joined: 20 Jul 2006 Posts: 164 Location: London
My take is that the -config attribute is made for this (node configuration). if you look at a target system running an erlang release you will see that it also uses -config

E.g. look in the installation directory where you have erlang inside the bin/start_erl file. this file starts erlang with the specified config.

find info about that attribute and others here:
http://www.erlang.org/doc/man/erl.html

good luck
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum