mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 01:40:21 +03:00
fd0a08ae8c
no issue
- add tests for makePathsAbsolute
- add support for windows paths
When Ghost-CLI inits the database of the current GhostVersion (in /current), then it uses knex-migrator to do that.
Knex migrator is reading the .knex-migrator file of the current Ghost version. This returns a relative path to the database location.
The problem: knex-migrator will init the database in the root folder of Ghost-CLI /content/data instead of /current/content . And when you start Ghost (ghost start), it always complains that
that database is not initialised, because it expects the database in /current/content...
* 🎨 move config_spec to config/index_spec
- add one more test case
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
var Nconf = require('nconf'),
|
|
nconf = new Nconf.Provider(),
|
|
path = require('path'),
|
|
localUtils = require('./utils'),
|
|
env = process.env.NODE_ENV || 'development';
|
|
|
|
/**
|
|
* command line arguments
|
|
*/
|
|
nconf.argv();
|
|
|
|
/**
|
|
* env arguments
|
|
*/
|
|
nconf.env({
|
|
separator: '__'
|
|
});
|
|
|
|
/**
|
|
* load config files
|
|
* @TODO:
|
|
* - why does this work? i have no idea!
|
|
* - find out why argv override works, when defining these weird keys
|
|
* - i could not find any nconf usages so that all config requirements work
|
|
*/
|
|
nconf.file('ghost1', __dirname + '/overrides.json');
|
|
nconf.file('ghost2', path.join(process.cwd(), 'config.' + env + '.json'));
|
|
nconf.file('ghost3', __dirname + '/env/config.' + env + '.json');
|
|
nconf.file('ghost4', __dirname + '/defaults.json');
|
|
|
|
/**
|
|
* transform all relative paths to absolute paths
|
|
* transform sqlite filename path for Ghost-CLI
|
|
*/
|
|
localUtils.makePathsAbsolute.bind(nconf)(nconf.get('paths'), 'paths');
|
|
localUtils.makePathsAbsolute.bind(nconf)(nconf.get('database:connection'), 'database:connection');
|
|
|
|
/**
|
|
* values we have to set manual
|
|
*/
|
|
nconf.set('env', env);
|
|
|
|
module.exports = nconf;
|
|
module.exports.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);
|
|
module.exports.getContentPath = localUtils.getContentPath.bind(nconf);
|