Created
August 29, 2015 22:54
-
-
Save nwade/7ef0e3c46fe0f3524280 to your computer and use it in GitHub Desktop.
Deploy ghost blog to Cloud Foundry (Pivotal Web Services)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'), | |
config; | |
var env = process.env.NODE_ENV || 'development'; | |
var production = env === 'production'; | |
var cfenv, appenv, sqlCredentials, mailCredentials; | |
if (production) { | |
cfenv = require('cfenv'); | |
appenv = cfenv.getAppEnv(); | |
// ghost-pg and ghost-mail are the names of my elephantsql and sendgrid service instances | |
// you must bind your app to your instances using the cf bs app_name service_name command | |
sqlCredentials = appenv.getService('ghost-pg').credentials; | |
mailCredentials = appenv.getService('ghost-mail').credentials; | |
} | |
config = { | |
// removed development config for brevity | |
... | |
// Cloud Foundry | |
production: { | |
url: appenv.url, | |
mail: { | |
transport: 'SMTP', | |
options: { | |
service: 'Sendgrid', | |
auth: { | |
user: mailCredentials.username, | |
pass: mailCredentials.password | |
} | |
} | |
}, | |
database: { | |
client: 'pg', | |
connection: sqlCredentials.uri, | |
pool: { | |
min: 2, | |
max: 4 | |
}, | |
debug: false | |
}, | |
server: { | |
host: appenv.bind, | |
port: appenv.port | |
}, | |
logging: false | |
} | |
}; | |
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
"dependencies": { | |
... | |
"cfenv": "^1.0.0", | |
... | |
"pg": "4.4.1", | |
... | |
}, | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment