Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ghost/core/core/server/services/settings/settings-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = {
SettingsCache.init(events, settingsCollection, this.getCalculatedFields(), cacheStore, settingsOverrides);

// Validate site_uuid matches config
await this.validateSiteUuid();
this.validateSiteUuid();
},

/**
Expand Down Expand Up @@ -158,7 +158,7 @@ module.exports = {
* The configured site_uuid is only used once when the site_uuid setting is set in a migration
* Exits with an error if they differ
*/
async validateSiteUuid() {
validateSiteUuid() {
const configSiteUuid = config.get('site_uuid');
const settingSiteUuid = SettingsCache.get('site_uuid');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,53 @@ describe('UNIT: Settings Service', function () {
});

describe('validateSiteUuid', function () {
it('should pass when config and setting UUIDs match', async function () {
it('should pass when config and setting UUIDs match', function () {
const uuid = '12345678-1234-1234-1234-123456789abc';
configUtils.set('site_uuid', uuid);
settingsCacheStub.withArgs('site_uuid').returns(uuid);

// Should not throw
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
});

it('should pass when config and setting UUIDs match with different cases', async function () {
it('should pass when config and setting UUIDs match with different cases', function () {
configUtils.set('site_uuid', '12345678-1234-1234-1234-123456789ABC');
settingsCacheStub.withArgs('site_uuid').returns('12345678-1234-1234-1234-123456789abc');

// Should not throw
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
});

it('should pass when config UUID is not set', async function () {
it('should pass when config UUID is not set', function () {
configUtils.set('site_uuid', null);
settingsCacheStub.withArgs('site_uuid').returns('12345678-1234-1234-1234-123456789abc');

// Should not throw
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
});

it('should pass when setting UUID is not set', async function () {
it('should pass when setting UUID is not set', function () {
configUtils.set('site_uuid', '12345678-1234-1234-1234-123456789abc');
settingsCacheStub.withArgs('site_uuid').returns(null);

// Should not throw
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
});

it('should pass when both UUIDs are not set', async function () {
it('should pass when both UUIDs are not set', function () {
configUtils.set('site_uuid', null);
settingsCacheStub.withArgs('site_uuid').returns(null);

// Should not throw
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
});

it('should throw IncorrectUsageError when UUIDs do not match', async function () {
it('should throw IncorrectUsageError when UUIDs do not match', function () {
configUtils.set('site_uuid', '12345678-1234-1234-1234-123456789abc');
settingsCacheStub.withArgs('site_uuid').returns('87654321-4321-4321-4321-cba987654321');

try {
await settingsService.validateSiteUuid();
settingsService.validateSiteUuid();
assert.fail('Should have thrown IncorrectUsageError');
} catch (error) {
sinon.assert.calledOnce(loggingStub);
Expand Down
Loading