From 2a31714d7746ff3cd8291b3f5067885a1568f764 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Wed, 12 Jul 2017 10:47:10 -0400 Subject: [PATCH] fix(config): add default dbpath when db is sqlite refs #349 - add defaultValue function to dbpath argument --- lib/commands/config/advanced.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/commands/config/advanced.js b/lib/commands/config/advanced.js index ba3ec6a18..b46ed4b05 100644 --- a/lib/commands/config/advanced.js +++ b/lib/commands/config/advanced.js @@ -77,7 +77,15 @@ module.exports = { description: 'Path to the database file (sqlite3 only)', configPath: 'database.connection.filename', type: 'string', - group: 'Database Options:' + group: 'Database Options:', + defaultValue: (config, environment) => { + if (config.get('database.client') !== 'sqlite3') { + return null; + } + + let dbFile = (environment === 'production') ? 'ghost.db' : 'ghost-dev.db'; + return `./content/data/${dbFile}`; + } }, dbhost: { description: 'Database host',