use env variables for eb deployment

pull/48/head
unknown 2019-03-20 15:08:19 -04:00
parent 9c6c841957
commit a7f2ef90d4
5 changed files with 36 additions and 6 deletions

2
.gitignore vendored
View File

@ -18,5 +18,3 @@ lib-cov
*.out *.out
*.pid *.pid
package-lock.json package-lock.json
ecosystem.config.js
knexfile.js

View File

@ -25,7 +25,7 @@ npm i
2. Create config files 2. Create config files
``` ```
touch knexfile.js ecosystem.config.js config/local.js touch config/local.js
``` ```
3. Add database info to knexfile and pm2 ecosystem 3. Add database info to knexfile and pm2 ecosystem
@ -109,4 +109,10 @@ eb deploy environment_name
``` ```
3. Configure environment variables on elastic beanstalk 3. Configure environment variables on elastic beanstalk
```
PASSPORT_GOOGLE_ID
PASSPORT_GOOGLE_SECRET
PASSPORT_GITHUB_ID
PASSPORT_GITHUB_SECRET
DATABASE_CONNECTION
```

View File

@ -10,12 +10,18 @@ module.exports.passport = {
strategy: require('passport-google-oauth20').Strategy, strategy: require('passport-google-oauth20').Strategy,
protocol: 'oauth2', protocol: 'oauth2',
callback: '/auth/google/callback', callback: '/auth/google/callback',
options: {} options: {
clientID: process.env.PASSPORT_GOOGLE_ID,
clientSecret: process.env.PASSPORT_GOOGLE_SECRET
}
}, },
github: { github: {
strategy: require('passport-github2').Strategy, strategy: require('passport-github2').Strategy,
protocol: 'oauth2', protocol: 'oauth2',
callback: '/auth/github/callback', callback: '/auth/github/callback',
options: {} options: {
clientID: process.env.PASSPORT_GITHUB_ID,
clientSecret: process.env.PASSPORT_GITHUB_SECRET
}
} }
} }

16
ecosystem.config.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
apps: [{
name: 'roe-base',
script: 'app.js',
instances: 1,
autorestart: true,
watch: false,
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production',
SAILS_DATASTORE_URL: process.env.DATABASE_CONNECTION
}
}]
}

4
knexfile.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
client: 'pg',
connection: process.env.DATABASE_CONNECTION
}