0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Organised default settings into new groups (#11952)

refs https://github.com/TryGhost/Ghost/issues/10318

- precursor to migrating from `settings.type` to `settings.group`
- renames `blog` type to `site`
- renames `bulk_email` type to `email`
- moves settings out of `site` (previously `blog`) into more appropriate groups such as `core` or individual feature groups
This commit is contained in:
Kevin Ansfield 2020-06-23 20:49:08 +01:00 committed by GitHub
parent adb5adea57
commit 8a817050c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 95 additions and 72 deletions

View file

@ -25,7 +25,7 @@ module.exports = {
// CASE: no context passed (functional call)
if (!frame.options.context) {
return Promise.resolve(settings.filter((setting) => {
return setting.type === 'blog';
return setting.type === 'site';
}));
}

View file

@ -23,7 +23,7 @@ module.exports = {
// CASE: no context passed (functional call)
if (!frame.options.context) {
return Promise.resolve(settings.filter((setting) => {
return setting.type === 'blog';
return setting.type === 'site';
}));
}

View file

@ -4,7 +4,7 @@ const _ = require('lodash');
const BaseImporter = require('./base');
const models = require('../../../../models');
const defaultSettings = require('../../../schema').defaultSettings;
const labsDefaults = JSON.parse(defaultSettings.blog.labs.defaultValue);
const labsDefaults = JSON.parse(defaultSettings.labs.labs.defaultValue);
const deprecatedSettings = ['active_apps', 'installed_apps'];
const isFalse = (value) => {

View file

@ -20,9 +20,18 @@
},
"ghost_private_key": {
"defaultValue": null
},
"members_public_key": {
"defaultValue": null
},
"members_private_key": {
"defaultValue": null
},
"members_email_auth_secret": {
"defaultValue": null
}
},
"blog": {
"site": {
"title": {
"defaultValue": "Ghost",
"validations": {
@ -48,8 +57,8 @@
"icon": {
"defaultValue": ""
},
"brand": {
"defaultValue": "{\"primaryColor\":\"\"}"
"accent_color": {
"defaultValue": ""
},
"default_locale": {
"defaultValue": "en",
@ -64,12 +73,6 @@
"isEmpty": false
}
},
"amp": {
"defaultValue" : "true",
"validations": {
"isIn": [["true", "false"]]
}
},
"ghost_head": {
"defaultValue" : ""
},
@ -82,21 +85,12 @@
"twitter": {
"defaultValue" : "tryghost"
},
"labs": {
"defaultValue": "{}"
},
"navigation": {
"defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"},{\"label\":\"Tag\", \"url\":\"/tag/getting-started/\"}, {\"label\":\"Author\", \"url\":\"/author/ghost/\"},{\"label\":\"Help\", \"url\":\"https://ghost.org/docs/\"}]"
},
"secondary_navigation": {
"defaultValue": "[]"
},
"slack": {
"defaultValue": "[{\"url\":\"\", \"username\":\"Ghost\"}]"
},
"unsplash": {
"defaultValue": "{\"isActive\": true}"
},
"meta_title": {
"defaultValue": null,
"validations": {
@ -160,9 +154,6 @@
"max": 300
}
}
},
"shared_views": {
"defaultValue": "{}"
}
},
"theme": {
@ -185,15 +176,6 @@
}
},
"members": {
"members_public_key": {
"defaultValue": null
},
"members_private_key": {
"defaultValue": null
},
"members_email_auth_secret": {
"defaultValue": null
},
"default_content_visibility": {
"defaultValue": "public"
},
@ -223,9 +205,37 @@
"defaultValue": "[\"free\", \"monthly\", \"yearly\"]"
}
},
"bulk_email": {
"email": {
"bulk_email_settings": {
"defaultValue": "{\"provider\":\"mailgun\", \"apiKey\": \"\", \"domain\": \"\", \"baseUrl\": \"\"}"
}
},
"amp": {
"amp": {
"defaultValue" : "true",
"validations": {
"isIn": [["true", "false"]]
}
}
},
"labs": {
"labs": {
"defaultValue": "{}"
}
},
"slack": {
"slack": {
"defaultValue": "[{\"url\":\"\", \"username\":\"Ghost\"}]"
}
},
"unsplash": {
"unsplash": {
"defaultValue": "{\"isActive\": true}"
}
},
"views": {
"shared_views": {
"defaultValue": "{}"
}
}
}

View file

@ -152,7 +152,20 @@ module.exports = {
maxlength: 50,
nullable: false,
defaultTo: 'core',
validations: {isIn: [['core', 'blog', 'theme', 'private', 'members', 'bulk_email', 'portal']]}
validations: {isIn: [[
'core',
'site',
'theme',
'private',
'members',
'portal',
'email',
'amp',
'labs',
'slack',
'unsplash',
'views'
]]}
},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},

View file

@ -1,5 +1,5 @@
/**
* The settings with type "blog" were originally meant to be public
* The settings with type "site" were originally meant to be public
* This has been misused - unsplash and slack are incorrectly stored there
* https://github.com/TryGhost/Ghost/issues/10318
*

View file

@ -7,7 +7,7 @@ const localUtils = require('./utils');
// Values to test against
const publicSettings = require('../../../core/server/services/settings/public');
const defaultSettings = require('../../../core/server/data/schema').defaultSettings.blog;
const defaultSettings = require('../../../core/server/data/schema').defaultSettings.site;
const ghost = testUtils.startGhost;
let request;

View file

@ -652,7 +652,7 @@ DataGenerator.forKnex = (function () {
uuid: '95ce1c53-69b0-4f5f-be91-d3aeb39046b5',
key: 'title',
value: null,
type: 'blog',
type: 'site',
created_at: new Date(),
created_by: DataGenerator.Content.users[0].id,
updated_at: new Date(),

View file

@ -2248,7 +2248,7 @@
"id": "5c2ca6e0e015a67616182411",
"key": "title",
"value": "Ghost",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2258,7 +2258,7 @@
"id": "5c2ca6e0e015a67616182412",
"key": "description",
"value": "The professional publishing platform",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2268,7 +2268,7 @@
"id": "5c2ca6e0e015a67616182413",
"key": "logo",
"value": "https://static.ghost.org/v1.0.0/images/ghost-logo.svg",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2278,7 +2278,7 @@
"id": "5c2ca6e0e015a67616182414",
"key": "cover_image",
"value": "https://static.ghost.org/v1.0.0/images/blog-cover.jpg",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2288,7 +2288,7 @@
"id": "5c2ca6e0e015a67616182415",
"key": "icon",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2298,7 +2298,7 @@
"id": "5c2ca6e0e015a67616182416",
"key": "default_locale",
"value": "en",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2308,7 +2308,7 @@
"id": "5c2ca6e0e015a67616182417",
"key": "active_timezone",
"value": "Etc/UTC",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2318,7 +2318,7 @@
"id": "5c2ca6e0e015a6761618241a",
"key": "amp",
"value": "true",
"type": "blog",
"type": "amp",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2328,7 +2328,7 @@
"id": "5c2ca6e0e015a6761618241b",
"key": "ghost_head",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2338,7 +2338,7 @@
"id": "5c2ca6e0e015a6761618241c",
"key": "ghost_foot",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2348,7 +2348,7 @@
"id": "5c2ca6e0e015a6761618241d",
"key": "facebook",
"value": "ghost",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2358,7 +2358,7 @@
"id": "5c2ca6e0e015a6761618241e",
"key": "twitter",
"value": "tryghost",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2368,7 +2368,7 @@
"id": "5c2ca6e0e015a6761618241f",
"key": "labs",
"value": "{\"publicAPI\": true}",
"type": "blog",
"type": "labs",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2378,7 +2378,7 @@
"id": "5c2ca6e0e015a67616182420",
"key": "navigation",
"value": "[{\"label\":\"Home\", \"url\":\"/\"},{\"label\":\"Tag\", \"url\":\"/tag/getting-started/\"}, {\"label\":\"Author\", \"url\":\"/author/ghost/\"},{\"label\":\"Help\", \"url\":\"https://ghost.org/docs/\"}]",
"type": "blog",
"type": "site",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2388,7 +2388,7 @@
"id": "5c2ca6e0e015a67616182421",
"key": "slack",
"value": "[{\"url\":\"\", \"username\":\"Ghost\"}]",
"type": "blog",
"type": "slack",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2398,7 +2398,7 @@
"id": "5c2ca6e0e015a67616182422",
"key": "unsplash",
"value": "{\"isActive\": true}",
"type": "blog",
"type": "unsplash",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2468,7 +2468,7 @@
"id": "5c2ca6e0e015a67616182429",
"key": "members_public_key",
"value": "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAJ/6gCIMJyUZsR+lwV/ObX1mYSt7MFcy7LcPeDvepSruyabB9Z98Tit6Npfr79cc\nvxt95S8oUxXqRKNQgrDyJG6NJLMx9rcU2OMmdLAG5wJVlBz0D1eOwIaGKDzjZL9B42QIJPsy\nFQiNntWGYgiIPjpUT2u4rnsV0ATo9TB/bk3xAgMBAAE=\n-----END RSA PUBLIC KEY-----\n",
"type": "members",
"type": "core",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",
@ -2478,7 +2478,7 @@
"id": "5c2ca6e0e015a6761618242a",
"key": "members_private_key",
"value": "-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQCf+oAiDCclGbEfpcFfzm19ZmErezBXMuy3D3g73qUq7smmwfWffE4rejaX\n6+/XHL8bfeUvKFMV6kSjUIKw8iRujSSzMfa3FNjjJnSwBucCVZQc9A9XjsCGhig842S/QeNk\nCCT7MhUIjZ7VhmIIiD46VE9ruK57FdAE6PUwf25N8QIDAQABAoGAZm70Gljju6qusg/lOJ4p\nlzC1qSywsDTIQxKhrtwJr+rDrYXl6x+hwc74I+CLapZae5Tp6X8NbCvblSKY/AmfbzEw4QnQ\nybQC5WVC/VPl6jWYIodpwUM7RdUNYqWMiY07XnSwL2ejXszW3MO3NPGqh1irp0U4RwutaRfV\n4D6xDMECQQDh4PdiYJetxrruQBg3u5E4VaX/M1xzRGqo4jCdaO3e4+M1WymcPGmHJC3cypzg\n0dEdkhD9KH1AziSEjEeu/9kZAkEAtU/V+nAsdxsUby6LMBIB+3y6DcQwwygobfwkD2A+3qVQ\nTHxNwh6kL2Xif9U9d4+w1XQE8kwmZsKoQ9z8PC2+mQJAHuGi8NBD7H4/EFOy++uo7wrGpx1e\nhmPUMUK7Ysn1u4NsjN7p0XJw+wj3PDh3OkV1UZWmvPXMKhAE7ho/sq1IAQJATURloyGUwXln\n3u3N4UF7WMpRm7ZFNZXyjNSMJYVVpZp7uuyqUpSuUYiw2ttsI3y31m9oAD4Vi2tfO/R8BcVU\n2QJBAM4tqJaEy4jQ4aa9XEfU0/LU1TwZbeHZJ8Y+pDarHfYiHShQ2JKlMDAeh/DNqD0VEpeI\nSeO5Hxbv/56NVT+pNQE=\n-----END RSA PRIVATE KEY-----\n",
"type": "members",
"type": "core",
"created_at": "2019-01-02T11:56:16.000Z",
"created_by": "1",
"updated_at": "2019-01-02T11:56:16.000Z",

View file

@ -1206,7 +1206,7 @@
"id": "59a952c2ebbf7206b369cdc6",
"key": "title",
"value": "a test blog",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1216,7 +1216,7 @@
"id": "59a952c2ebbf7206b369cdc7",
"key": "description",
"value": "Thoughts, stories and ideas.",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1226,7 +1226,7 @@
"id": "59a952c2ebbf7206b369cdc8",
"key": "logo",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1236,7 +1236,7 @@
"id": "59a952c2ebbf7206b369cdc9",
"key": "cover_image",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1246,7 +1246,7 @@
"id": "59a952c2ebbf7206b369cdca",
"key": "icon",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:29:54.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:29:54.000Z",
@ -1256,7 +1256,7 @@
"id": "59a952c2ebbf7206b369cdcb",
"key": "default_locale",
"value": "en",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:29:54.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:29:54.000Z",
@ -1266,7 +1266,7 @@
"id": "59a952c2ebbf7206b369cdcc",
"key": "active_timezone",
"value": "Etc/UTC",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1276,7 +1276,7 @@
"id": "59a952c2ebbf7206b369cdcf",
"key": "amp",
"value": "true",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1286,7 +1286,7 @@
"id": "59a952c2ebbf7206b369cdd0",
"key": "ghost_head",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1296,7 +1296,7 @@
"id": "59a952c2ebbf7206b369cdd1",
"key": "ghost_foot",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1306,7 +1306,7 @@
"id": "59a952c2ebbf7206b369cdd2",
"key": "facebook",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1316,7 +1316,7 @@
"id": "59a952c2ebbf7206b369cdd3",
"key": "twitter",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1326,7 +1326,7 @@
"id": "59a952c2ebbf7206b369cdd4",
"key": "labs",
"value": "{\"publicAPI\":true}",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1336,7 +1336,7 @@
"id": "59a952c2ebbf7206b369cdd5",
"key": "navigation",
"value": "[{\"label\":\"Home\", \"url\":\"/\"}]",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1346,7 +1346,7 @@
"id": "59a952c2ebbf7206b369cdd6",
"key": "slack",
"value": "[{\"url\":\"https://hook.slack.com\"}]",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:18:30.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:30:47.000Z",
@ -1356,7 +1356,7 @@
"id": "59a952c2ebbf7206b369cdd7",
"key": "unsplash",
"value": "",
"type": "blog",
"type": "site",
"created_at": "2017-09-01T12:29:54.000Z",
"created_by": "1",
"updated_at": "2017-09-01T12:29:54.000Z",