Skip to content

Commit 22c804c

Browse files
authored
fix(instance): clean up config usage around application (#254)
1 parent b6ae853 commit 22c804c

File tree

12 files changed

+44
-42
lines changed

12 files changed

+44
-42
lines changed

extensions/nginx/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class NginxExtension extends cli.Extension {
3030
}
3131

3232
this.instance = this.system.getInstance();
33-
this.instance.loadConfig();
3433

3534
cmd.addStage('nginx', this.setupNginx.bind(this));
3635
cmd.addStage('ssl', this.setupSSL.bind(this));
@@ -219,7 +218,6 @@ class NginxExtension extends cli.Extension {
219218

220219
uninstall() {
221220
this.instance = this.system.getInstance();
222-
this.instance.loadConfig();
223221

224222
if (!this.instance.cliConfig.get('extension.nginx', false)) {
225223
return;

extensions/systemd/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class SystemdExtension extends cli.Extension {
1414

1515
setup(cmd, argv) {
1616
let instance = this.system.getInstance();
17-
instance.loadConfig();
1817

1918
if (!argv.local && instance.config.get('process') === 'systemd') {
2019
cmd.addStage('systemd', this._setup.bind(this));

lib/commands/config/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class ConfigCommand extends Command {
1414
super(ui, system);
1515

1616
let instance = this.system.getInstance();
17-
instance.loadConfig(true);
1817
this.config = instance.config;
1918
}
2019

lib/commands/log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LogCommand extends Command {
1919
// relative to that
2020
process.chdir(instance.dir);
2121

22-
instance.loadRunningConfig(true);
22+
instance.loadRunningEnvironment(true);
2323

2424
// Check if logging file transport is set in config
2525
if (!includes(instance.config.get('logging.transports', []), 'file')) {

lib/commands/restart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class RestartCommand extends Command {
1111
return Promise.reject(new Error('Ghost instance is not currently running.'));
1212
}
1313

14-
instance.loadRunningConfig(true, true);
14+
instance.loadRunningEnvironment(true, true);
1515

1616
return this.runCommand(StopCommand, argv).then(() => this.runCommand(StartCommand, argv));
1717
}

lib/commands/run.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class RunCommand extends Command {
1313
}
1414

1515
let instance = this.system.getInstance();
16-
instance.loadConfig(true);
1716

1817
process.env.paths__contentPath = path.join(process.cwd(), 'content');
1918

lib/commands/setup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class SetupCommand extends Command {
6666
title: 'Setting up instance',
6767
task: () => {
6868
let instance = this.system.getInstance();
69-
instance.loadConfig();
7069
instance.name = argv.pname || url.parse(instance.config.get('url')).hostname.replace(/\./g, '-');
7170
this.system.addInstance(instance);
7271
}

lib/commands/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class StartCommand extends Command {
2727
return Promise.reject(new Error('Ghost is already running.'));
2828
}
2929

30-
instance.loadConfig();
30+
instance.checkEnvironment();
3131

3232
return this.ui.listr(startupChecks.concat({
3333
title: 'Running database migrations',

lib/commands/stop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class StopCommand extends Command {
4141
return Promise.reject(new errors.SystemError('No running Ghost instance found here.'));
4242
}
4343

44-
instance.loadRunningConfig();
44+
instance.loadRunningEnvironment(true);
4545

4646
let stop = () => Promise.resolve(instance.process.stop(process.cwd())).then(() => {
4747
instance.running = null;

lib/commands/uninstall.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ class UninstallCommand extends Command {
3131
return Promise.resolve();
3232
}
3333

34-
instance.loadRunningConfig(true, true);
34+
instance.loadRunningEnvironment(true, true);
3535

3636
// If the instance is currently running we need to make
3737
// sure it gets stopped
3838
return this.runCommand(StopCommand);
3939
}).then(() => {
4040
this.system.setEnvironment(!fs.existsSync('config.production.json'));
41-
instance.loadConfig(true);
4241

4342
return this.ui.run(this.system.hook('uninstall'), 'Removing related configuration');
4443
}).then(() => this.ui.run(() => {

0 commit comments

Comments
 (0)