Environment variables in applications

View: New views
3 Messages — Rating Filter:   Alert me  

Environment variables in applications

by Alexander Lamb-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am writing an OTP application which will create a Mnesia database if  
needed (will check upon init if schema exists on that node).

Since I can't give a path in the mnesia:create_schema(node())  
function, from the documentation I read that it takes the environment  
variable "dir" so I hoped I could pass it in my application file such  
as this:

{application,cs_foundations,
        [
                {description, "Foundations for handling roles and studies"},
                {vsn,"1.0.0"},
                {modules, [sasl,cs_guuid,cs_mnesia]},
                {registered, [cs_guuid,cs_mnesia,cs_foundations_sup]},
                {applications, [kernel,stdlib,sasl]},
                {env,[]},
                {mod, {cs_foundations_app,[]}},
                {start_phases, []},
                {env, [{core_dir, "/Users/alamb/Data/Mnesia"},{dir, "/Users/alamb/
Data/Mnesia"}]}
        ]
}.

Unfortunately, it doesn't seem to work. Any workaround?

Thanks,

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

Parent Message unknown Re: Environment variables in applications

by Alexander Lamb-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I have the env entry twice, but even removing the empty one, I now  
get the environment variables "dir" and "core_dir" in my program, but  
mnesia does not seem to take them into account.

Alex

Le 2 juil. 08 à 17:41, Alexander Lamb a écrit :

> Hello,
>
> I am writing an OTP application which will create a Mnesia database if
> needed (will check upon init if schema exists on that node).
>
> Since I can't give a path in the mnesia:create_schema(node())
> function, from the documentation I read that it takes the environment
> variable "dir" so I hoped I could pass it in my application file such
> as this:
>
> {application,cs_foundations,
> [
> {description, "Foundations for handling roles and studies"},
> {vsn,"1.0.0"},
> {modules, [sasl,cs_guuid,cs_mnesia]},
> {registered, [cs_guuid,cs_mnesia,cs_foundations_sup]},
> {applications, [kernel,stdlib,sasl]},
> {env,[]},
> {mod, {cs_foundations_app,[]}},
> {start_phases, []},
> {env, [{core_dir, "/Users/alamb/Data/Mnesia"},{dir, "/Users/alamb/
> Data/Mnesia"}]}
> ]
> }.
>
> Unfortunately, it doesn't seem to work. Any workaround?
>
> Thanks,
>
> Alex
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@...
> http://www.erlang.org/mailman/listinfo/erlang-questions
>

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

Re: Environment variables in applications

by Paul Fisher-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-07-02 at 17:41 +0200, Alexander Lamb wrote:
> Hello,
>
> I am writing an OTP application which will create a Mnesia database if  
> needed (will check upon init if schema exists on that node).
>
> Since I can't give a path in the mnesia:create_schema(node())  
> function, from the documentation I read that it takes the environment  
> variable "dir" so I hoped I could pass it in my application file such  
> as this:

It needs to be set as an attribute of the mnesia application and not
your application which uses mnesia:

$ erl -mnesia dir \"/Users/alamb/Data/Mnesia\"


--
paul

_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions
LightInTheBox - Buy quality products at wholesale price