Skip to content

Commit

Permalink
fix(start): fix warning behavior (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed May 22, 2021
1 parent fb4d624 commit c809873
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ class StartCommand extends Command {
return;
}

const url = instance.config.get('url');
instance.checkEnvironment();

if (this.system.environment === 'production' && url.startsWith('http://')) {
if (this.system.environment === 'production' && instance.config.get('url', '').startsWith('http://')) {
this.ui.log([
'Using https on all URLs is highly recommended. In production, SSL is required when using Stripe.',
'Support for non-https admin URLs in production mode is deprecated and will be removed in a future version.'
].join('\n'), 'yellow');
}

instance.checkEnvironment();
await this.runCommand(DoctorCommand, {categories: ['start'], ...argv, quiet: true});
await this.ui.run(() => instance.start(argv.enable), `Starting Ghost: ${instance.name}`, runOptions);

Expand Down
4 changes: 2 additions & 2 deletions test/unit/commands/start-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Unit: Commands > Start', function () {
expect(run.calledOnce).to.be.true;
expect(start.calledOnce).to.be.true;
expect(log.calledTwice).to.be.true;
expect(instance.config.get.calledThrice).to.be.true;
expect(instance.config.get.calledTwice).to.be.true;
});

it('doesn\'t log if quiet is set to true', async function () {
Expand All @@ -157,7 +157,7 @@ describe('Unit: Commands > Start', function () {
expect(run.calledOnce).to.be.true;
expect(start.calledOnce).to.be.true;
expect(log.called).to.be.false;
expect(instance.config.get.calledOnce).to.be.true;
expect(instance.config.get.called).to.be.false;
});
});

Expand Down

0 comments on commit c809873

Please sign in to comment.