Updated host config to correctly use camelCase

refs https://github.com/TryGhost/Team/issues/510

- When the host config was introduced it was incorrectly introduced as host_settings instead of hostSettings
- All other Ghost config uses camelCase, so changing this now before it becomes a problem
- Note: Also removed some rogue return awaits that don't make sense. It's not possible to hit that case, but cleaning up anyway
This commit is contained in:
Hannah Wolfe 2021-03-04 11:34:11 +00:00
parent 84e5bdc46a
commit 26f56626ce
7 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@ module.exports = {
read: { read: {
permissions: false, permissions: false,
query() { query() {
const billingUrl = config.get('host_settings:billing:enabled') ? config.get('host_settings:billing:url') : ''; const billingUrl = config.get('hostSettings:billing:enabled') ? config.get('hostSettings:billing:url') : '';
const response = { const response = {
version: ghostVersion.full, version: ghostVersion.full,
environment: config.get('env'), environment: config.get('env'),

View File

@ -76,8 +76,8 @@ module.exports = {
if (frame.options.source === 'github') { if (frame.options.source === 'github') {
const [org, repo] = frame.options.ref.toLowerCase().split('/'); const [org, repo] = frame.options.ref.toLowerCase().split('/');
if (limitService.isLimited('custom_themes') && org.toLowerCase() !== 'tryghost') { if (limitService.isLimited('customThemes') && org.toLowerCase() !== 'tryghost') {
await limitService.errorIfWouldGoOverLimit('custom_themes'); await limitService.errorIfWouldGoOverLimit('customThemes');
} }
// omit /:ref so we fetch the default branch // omit /:ref so we fetch the default branch
@ -139,8 +139,8 @@ module.exports = {
method: 'add' method: 'add'
}, },
async query(frame) { async query(frame) {
if (limitService.isLimited('custom_themes')) { if (limitService.isLimited('customThemes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes'); await limitService.errorIfWouldGoOverLimit('customThemes');
} }
// @NOTE: consistent filename uploads // @NOTE: consistent filename uploads

View File

@ -53,8 +53,8 @@ module.exports = {
method: 'add' method: 'add'
}, },
async query(frame) { async query(frame) {
if (limitService.isLimited('custom_themes')) { if (limitService.isLimited('customThemes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes'); await limitService.errorIfWouldGoOverLimit('customThemes');
} }
// @NOTE: consistent filename uploads // @NOTE: consistent filename uploads

View File

@ -53,8 +53,8 @@ module.exports = {
method: 'add' method: 'add'
}, },
async query(frame) { async query(frame) {
if (limitService.isLimited('custom_themes')) { if (limitService.isLimited('customThemes')) {
return await limitService.errorIfWouldGoOverLimit('custom_themes'); await limitService.errorIfWouldGoOverLimit('customThemes');
} }
// @NOTE: consistent filename uploads // @NOTE: consistent filename uploads

View File

@ -66,10 +66,10 @@ const Integration = ghostBookshelf.Model.extend({
async permissible(integrationModel, action) { async permissible(integrationModel, action) {
const isAdd = (action === 'add'); const isAdd = (action === 'add');
if (isAdd && limitService.isLimited('custom_integrations')) { if (isAdd && limitService.isLimited('customIntegrations')) {
// CASE: if your site is limited to a certain number of custom integrations // CASE: if your site is limited to a certain number of custom integrations
// Inviting a new custom integration requires we check we won't go over the limit // Inviting a new custom integration requires we check we won't go over the limit
await limitService.errorIfWouldGoOverLimit('custom_integrations'); await limitService.errorIfWouldGoOverLimit('customIntegrations');
} }
return true; return true;
} }

View File

@ -6,17 +6,17 @@ let limitService = new LimitService();
const initFn = () => { const initFn = () => {
let helpLink; let helpLink;
if (!config.get('host_settings') || !config.get('host_settings:limits')) { if (!config.get('hostSettings') || !config.get('hostSettings:limits')) {
return; return;
} }
if (config.get('host_settings:billing:enabled') && config.get('host_settings:billing:enabled') === true && config.get('host_settings:billing:url')) { if (config.get('hostSettings:billing:enabled') && config.get('hostSettings:billing:enabled') === true && config.get('hostSettings:billing:url')) {
helpLink = config.get('host_settings:billing:url'); helpLink = config.get('hostSettings:billing:url');
} else { } else {
helpLink = 'https://ghost.org/help/'; helpLink = 'https://ghost.org/help/';
} }
limitService.loadLimits({limits: config.get('host_settings:limits'), db, helpLink}); limitService.loadLimits({limits: config.get('hostSettings:limits'), db, helpLink});
}; };
module.exports = limitService; module.exports = limitService;

View File

@ -8,10 +8,10 @@ async function getTotalMembers() {
} }
module.exports = async () => { module.exports = async () => {
const membersHostLimit = config.get('host_settings:limits:members'); const membersHostLimit = config.get('hostSettings:limits:members');
if (membersHostLimit) { if (membersHostLimit) {
const allowedMembersLimit = membersHostLimit.max; const allowedMembersLimit = membersHostLimit.max;
const hostUpgradeLink = config.get('host_settings:limits').upgrade_url; const hostUpgradeLink = config.get('hostSettings:limits').upgrade_url;
const totalMembers = await getTotalMembers(); const totalMembers = await getTotalMembers();