0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-25 02:31:59 -05:00
ghost/core/server/api/v3/config.js
Aileen Nowak 989ab0edb5 Added forceUpgrade config settings
no issue

- Added the `forceUpgrade` config setting to be able to use it together with BMA.
- The flag is a property of `host_settings` and is passed to the Admin client
2021-10-25 09:45:40 +02:00

42 lines
1.8 KiB
JavaScript

const {isPlainObject} = require('lodash');
const config = require('../../../shared/config');
const labs = require('../../services/labs');
const ghostVersion = require('../../lib/ghost-version');
module.exports = {
docName: 'config',
read: {
permissions: false,
query() {
const billingUrl = config.get('host_settings:billing:enabled') ? config.get('host_settings:billing:url') : '';
const domainUrl = config.get('host_settings:domain:enabled') ? config.get('host_settings:domain:url') : '';
const updateUrl = config.get('host_settings:update:enabled') ? config.get('host_settings:update:url') : '';
const response = {
version: ghostVersion.full,
environment: config.get('env'),
database: config.get('database').client,
mail: isPlainObject(config.get('mail')) ? config.get('mail').transport : '',
useGravatar: !config.isPrivacyDisabled('useGravatar'),
labs: labs.getAll(),
clientExtensions: config.get('clientExtensions') || {},
enableDeveloperExperiments: config.get('enableDeveloperExperiments') || false,
stripeDirect: config.get('stripeDirect'),
mailgunIsConfigured: config.get('bulkEmail') && config.get('bulkEmail').mailgun,
emailAnalytics: config.get('emailAnalytics'),
forceUpgrade: config.get('host_settings:forceUpgrade') || false
};
if (billingUrl) {
response.billingUrl = billingUrl;
}
if (domainUrl) {
response.domainUrl = domainUrl;
}
if (updateUrl) {
response.updateUrl = updateUrl;
}
return response;
}
}
};