cobyism/ghost-on-heroku

Ghost v1.0 will not support config.js anymore.

Closed this issue · 5 comments

Check https://github.com/TryGhost/Ghost/commits/master/config.example.js for detail.

That means we cannot run node server.js to load config.js just like before?

After reading the issue and the code, their move to use nconf has made any heroku integration much more tricky since nconf expects preexisting json files, and they merge the config as the server gets initialized (can't monkey patch after).

Given that for heroku we need dynamic variables (such as the PORT) the only viable option would be to override the configuration file before invoking the server initialization.

I will try to give it a run when I have time.

Update:
Here is a trivial example in how to override a key in the config:

var ghost = require('ghost');

ghost().then(function (ghostServer) {
    var config = require('./node_modules/ghost/core/server/config');
    config.set('server:port', process.env.PORT);
    console.log(config);
    ghostServer.start();
});

We can probably remove the hardcoded path (at least partially) using require.resolve()

The real solution should be as simple as calling config.overrides({ ... });

My 2cents.

@cobyism FYI, hopefully one less blocker :)

mars commented

See PR for Ghost 1.x: #119

In that branch the new config.production.json file is generated through a .profile script that builds upon the previous config.js logic.

It's also possible to directly use environment variables with a few limitations. These may be set a config vars:

heroku config:set privacy__useUpdateCheck=false

#119 has been merged in, so I’m going to close this out.