Community
cancel
Showing results for 
Search instead for 
Did you mean: 
PReic1
Novice
1,008 Views

Environment Variables not accessible

Hi everyone

I'm trying to write a node.js app, which relays on some environment variables which I have put in the .bash_profile file. When I start the node.js application by command line, everything works find and the variables are readable (env.process.FOO). But when I start the app from the XDK, it seems that the app can not reach the variables.

I think the problem is, that while in cli, I'm root, whereas in the other case I'm the xdk deamon. Any ideas on how to access the environment variables even when run from the XDK?

thanks already!

Tags (1)
8 Replies
jhane2
New Contributor I
132 Views

Did you try putting them in /etc/profile instead of root's profile?

jeff

PReic1
Novice
132 Views

hey jhane.

thanks for the idea, sadly it didn't work. it's still the same behaviour :/

best

pascal

Carlos_M_Intel
Employee
132 Views

Hi digi

Could you attached the .bash_profile file you are using?

Have you tried to put the variables in /node_app_slot?

When running from the XDK, are you receiving an error message in the log o is it just that it's not running?

Regards,

Charlie

PReic1
Novice
132 Views

Hey Charlie

export FOO="BAR"

This is already the whole .bash_profile file (either appended to /etc/profile or as an own file in /home/root/.bash_profile.

The logging looks like this

console.log(process.env.FOO);

If running from command line, it logs the following:

BAR

If running from the XDK

undefined

Putting the file in /.node_app_slot does not seem to work.

thanks!

regards

pascal

Matthias_H_Intel
Employee
132 Views

can't reproduce - works fine for me.

have you rebooted your board after updating /etc/profile?

PReic1
Novice
132 Views

multiple times

so after you put everything into /etc/profile , you just rebooted and could access it from within process.env.FOO ?

thanks!

Matthias_H_Intel
Employee
132 Views

not "FOO" but console.log(process.env.NODE_PATH) which is already defined in /etc/profiles

Carlos_M_Intel
Employee
132 Views

Hi digi

Did you try the same thing as mhahn? Do you still have the same problem?

Regards,

Charlie

Reply