Setting Up - Second Instance

I have set up a second instance of this blog Catsie Blog using the same code base.

Ghost's config is really well decoupled and exposed in its config.js file. What this facilitates is setting up a second config with the second instances details and then hacking Ghost justs a little to take the config name as a parameter and a second hack to use that when it loads the config file.


Add this to the beginning of the file after the rest of the other variables (lets say after line 21):

var configPrefix = '';

if(process.argv.length > 2){    
    configPrefix = process.argv[2];

This checks the third parameter used when starting the application for example using node index.js test would set configPrefix to 'test'.

Then use this when it loads up the config (as of 0.11.4 around line 221):

config:           this._config.paths.config || path.join(appRoot, configPrefix + (configPrefix != '' ? '-' : '') + 'config.js'),

configPrefix != '' ? '-' : '' just adds a dash between the config-prefix and config.js

So altogether starting the app with node index.js test would use the file 'test-config.js' to configure the app.

Bob is then your uncle.

Be careful to change the database

database: {
    client: 'sqlite3',
    connection: {
        filename: path.join(__dirname, '/content/data/[your db name here].db')
    debug: false