This question already has an answer here:
I have a Node.js app which I want to deploy on my VM machine. Before starting the app, I want to set few commands which should be read before the app is started.
I placed those commands inside
.bashrc just similar to what I have done on my local environment.
Sample Command in
export TOY_DIR=~/work/git/toyPlayer export TOY_PLAYER_ENV=dev
Now, when I am running my app with
node app.js. It is throwing me an error that environment not found. However this thing works perfectly on my localbox.
After some google search, I tried this command
tmux node app.js
It started node server fine but now I am not able to exit from tmux shell. I used CTRL+C to exit but it stopped the node server.
PS: I know I can do remote login to it and work. But I am trying to learn doing things with command line.
What is the best practice to achieve this ?
PPS: I do not want to detect if the shell is controlled from SSH. I want to export some variables before starting my Node app. These variables are environment variables which are read by a config.js present inside my app.
Here is an example, How am I using the environment variables.
var env = process.env['TOY_PLAYER_ENV']
My question is How to set these variables on my remote machine ?