samedi 24 janvier 2015

AWS, Express.js - Setting server to production

I'm developing my app locally and running on an EC2 instance on AWS. I'm wanting to differentiate between production and development and added this to my main.js file:



switch (app.settings.env) {
case 'production':
app.locals.base = 'example1.com';
break;
case 'development':
app.locals.base = 'example2.com:8081';
break;
default:
}


Both my local and remote install of the app use development's declaration for app.locals.base. How can I "mark" my AWS instance as the production environment so that my app recognizes it?


NOTE: I tried adding this in my AWS Console



$ echo export NODE_ENV=production >> ~/.bash_profile
$ source ~/.bash_profile


And the contents of .bash_profile



# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export NODE_ENV=production




Aucun commentaire:

Enregistrer un commentaire