mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Updated default settings and schema with updated types
refs https://github.com/TryGhost/Ghost/issues/10318 - Updates default settings to contain correct type and validation for each setting - Updates `populateDefaults` to correctly insert type value for new settings - Updates settings schema to allow only select types - `array`, `number`, `boolean`, `string` - `object` is a temporary type allowed till we get rid of all JSON object settings
This commit is contained in:
parent
01633470f8
commit
8a50a3e9c9
3 changed files with 127 additions and 73 deletions
|
@ -1,34 +1,44 @@
|
||||||
{
|
{
|
||||||
"core": {
|
"core": {
|
||||||
"db_hash": {
|
"db_hash": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"next_update_check": {
|
"next_update_check": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "number"
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"defaultValue": "[]"
|
"defaultValue": "[]",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
"session_secret": {
|
"session_secret": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"theme_session_secret": {
|
"theme_session_secret": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"ghost_public_key": {
|
"ghost_public_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"ghost_private_key": {
|
"ghost_private_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"members_public_key": {
|
"members_public_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"members_private_key": {
|
"members_private_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"members_email_auth_secret": {
|
"members_email_auth_secret": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"site": {
|
"site": {
|
||||||
|
@ -39,7 +49,8 @@
|
||||||
"max": 150
|
"max": 150
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flags": "PUBLIC"
|
"flags": "PUBLIC",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"defaultValue": "The professional publishing platform",
|
"defaultValue": "The professional publishing platform",
|
||||||
|
@ -48,51 +59,64 @@
|
||||||
"max": 200
|
"max": 200
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flags": "PUBLIC"
|
"flags": "PUBLIC",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"logo": {
|
"logo": {
|
||||||
"defaultValue": "https://static.ghost.org/v1.0.0/images/ghost-logo.svg"
|
"defaultValue": "https://static.ghost.org/v1.0.0/images/ghost-logo.svg",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cover_image": {
|
"cover_image": {
|
||||||
"defaultValue": "https://static.ghost.org/v3.0.0/images/publication-cover.png"
|
"defaultValue": "https://static.ghost.org/v3.0.0/images/publication-cover.png",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"icon": {
|
"icon": {
|
||||||
"defaultValue": ""
|
"defaultValue": "",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"accent_color": {
|
"accent_color": {
|
||||||
"defaultValue": "",
|
"defaultValue": "",
|
||||||
"flags": "PUBLIC"
|
"flags": "PUBLIC",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"lang": {
|
"lang": {
|
||||||
"defaultValue": "en",
|
"defaultValue": "en",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isEmpty": false
|
"isEmpty": false
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"timezone": {
|
"timezone": {
|
||||||
"defaultValue": "Etc/UTC",
|
"defaultValue": "Etc/UTC",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isTimezone": true,
|
"isTimezone": true,
|
||||||
"isEmpty": false
|
"isEmpty": false
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"codeinjection_head": {
|
"codeinjection_head": {
|
||||||
"defaultValue" : ""
|
"defaultValue": "",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"codeinjection_foot": {
|
"codeinjection_foot": {
|
||||||
"defaultValue" : ""
|
"defaultValue": "",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"facebook": {
|
"facebook": {
|
||||||
"defaultValue" : "ghost"
|
"defaultValue": "ghost",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
"defaultValue" : "tryghost"
|
"defaultValue": "tryghost",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"},{\"label\":\"Tag\", \"url\":\"/tag/getting-started/\"}, {\"label\":\"Author\", \"url\":\"/author/ghost/\"},{\"label\":\"Help\", \"url\":\"https://ghost.org/docs/\"}]"
|
"defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"},{\"label\":\"Tag\", \"url\":\"/tag/getting-started/\"}, {\"label\":\"Author\", \"url\":\"/author/ghost/\"},{\"label\":\"Help\", \"url\":\"https://ghost.org/docs/\"}]",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
"secondary_navigation": {
|
"secondary_navigation": {
|
||||||
"defaultValue": "[]"
|
"defaultValue": "[]",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
"meta_title": {
|
"meta_title": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -100,7 +124,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 300
|
"max": 300
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"meta_description": {
|
"meta_description": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -108,7 +133,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 500
|
"max": 500
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"og_image": {
|
"og_image": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -116,7 +142,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 2000
|
"max": 2000
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"og_title": {
|
"og_title": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -124,7 +151,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 300
|
"max": 300
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"og_description": {
|
"og_description": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -132,7 +160,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 300
|
"max": 300
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"twitter_image": {
|
"twitter_image": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -140,7 +169,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 2000
|
"max": 2000
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"twitter_title": {
|
"twitter_title": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -148,7 +178,8 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 300
|
"max": 300
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"twitter_description": {
|
"twitter_description": {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
|
@ -156,13 +187,15 @@
|
||||||
"isLength": {
|
"isLength": {
|
||||||
"max": 300
|
"max": 300
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"active_theme": {
|
"active_theme": {
|
||||||
"defaultValue": "casper",
|
"defaultValue": "casper",
|
||||||
"flags": "RO"
|
"flags": "RO",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"private": {
|
"private": {
|
||||||
|
@ -170,104 +203,132 @@
|
||||||
"defaultValue": "false",
|
"defaultValue": "false",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isIn": [["true", "false"]]
|
"isIn": [["true", "false"]]
|
||||||
}
|
},
|
||||||
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"password": {
|
"password": {
|
||||||
"defaultValue": ""
|
"defaultValue": "",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"public_hash": {
|
"public_hash": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"members": {
|
"members": {
|
||||||
"default_content_visibility": {
|
"default_content_visibility": {
|
||||||
"defaultValue": "public"
|
"defaultValue": "public",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"members_allow_free_signup": {
|
"members_allow_free_signup": {
|
||||||
"defaultValue": "true"
|
"defaultValue": "true",
|
||||||
|
"validations": {
|
||||||
|
"isEmpty": false,
|
||||||
|
"isIn": [["true", "false"]]
|
||||||
|
},
|
||||||
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"members_from_address": {
|
"members_from_address": {
|
||||||
"defaultValue": "noreply",
|
"defaultValue": "noreply",
|
||||||
"flags": "RO"
|
"flags": "RO",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_product_name": {
|
"stripe_product_name": {
|
||||||
"defaultValue": "Ghost Subscription"
|
"defaultValue": "Ghost Subscription",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_secret_key": {
|
"stripe_secret_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_publishable_key": {
|
"stripe_publishable_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_plans": {
|
"stripe_plans": {
|
||||||
"defaultValue": "[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":500},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":5000}]"
|
"defaultValue": "[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":500},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":5000}]",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
"stripe_connect_publishable_key": {
|
"stripe_connect_publishable_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_connect_secret_key": {
|
"stripe_connect_secret_key": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_connect_livemode": {
|
"stripe_connect_livemode": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"stripe_connect_display_name": {
|
"stripe_connect_display_name": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"stripe_connect_account_id": {
|
"stripe_connect_account_id": {
|
||||||
"defaultValue": null
|
"defaultValue": null,
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"portal" : {
|
"portal": {
|
||||||
"portal_name": {
|
"portal_name": {
|
||||||
"defaultValue": "true",
|
"defaultValue": "true",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isEmpty": false,
|
"isEmpty": false,
|
||||||
"isIn": [["true", "false"]]
|
"isIn": [["true", "false"]]
|
||||||
}
|
},
|
||||||
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"portal_button": {
|
"portal_button": {
|
||||||
"defaultValue": "true",
|
"defaultValue": "true",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isEmpty": false,
|
"isEmpty": false,
|
||||||
"isIn": [["true", "false"]]
|
"isIn": [["true", "false"]]
|
||||||
}
|
},
|
||||||
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"portal_plans": {
|
"portal_plans": {
|
||||||
"defaultValue": "[\"free\", \"monthly\", \"yearly\"]"
|
"defaultValue": "[\"free\", \"monthly\", \"yearly\"]",
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"bulk_email_settings": {
|
"bulk_email_settings": {
|
||||||
"defaultValue": "{\"provider\":\"mailgun\", \"apiKey\": \"\", \"domain\": \"\", \"baseUrl\": \"\"}"
|
"defaultValue": "{\"provider\":\"mailgun\", \"apiKey\": \"\", \"domain\": \"\", \"baseUrl\": \"\"}",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"amp": {
|
"amp": {
|
||||||
"amp": {
|
"amp": {
|
||||||
"defaultValue" : "true",
|
"defaultValue": "true",
|
||||||
"validations": {
|
"validations": {
|
||||||
"isIn": [["true", "false"]]
|
"isIn": [["true", "false"]]
|
||||||
}
|
},
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labs": {
|
"labs": {
|
||||||
"labs": {
|
"labs": {
|
||||||
"defaultValue": "{}"
|
"defaultValue": "{}",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"slack": {
|
"slack": {
|
||||||
"slack": {
|
"slack": {
|
||||||
"defaultValue": "[{\"url\":\"\", \"username\":\"Ghost\"}]"
|
"defaultValue": "[{\"url\":\"\", \"username\":\"Ghost\"}]",
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unsplash": {
|
"unsplash": {
|
||||||
"unsplash": {
|
"unsplash": {
|
||||||
"defaultValue": "{\"isActive\": true}"
|
"defaultValue": "{\"isActive\": true}",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"views": {
|
"views": {
|
||||||
"shared_views": {
|
"shared_views": {
|
||||||
"defaultValue": "[]"
|
"defaultValue": "[]",
|
||||||
|
"type": "array"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,18 +176,12 @@ module.exports = {
|
||||||
defaultTo: 'core',
|
defaultTo: 'core',
|
||||||
validations: {
|
validations: {
|
||||||
isIn: [[
|
isIn: [[
|
||||||
'amp',
|
'array',
|
||||||
'core',
|
'string',
|
||||||
'email',
|
'number',
|
||||||
'labs',
|
'boolean',
|
||||||
'members',
|
// TODO: `object` type needs to be removed once all existing object settings are removed
|
||||||
'portal',
|
'object'
|
||||||
'private',
|
|
||||||
'site',
|
|
||||||
'slack',
|
|
||||||
'theme',
|
|
||||||
'unsplash',
|
|
||||||
'views'
|
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,8 +56,7 @@ function parseDefaultSettings() {
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(defaultSettingsInCategories, function each(settings, categoryName) {
|
_.each(defaultSettingsInCategories, function each(settings, categoryName) {
|
||||||
_.each(settings, function each(setting, settingName) {
|
_.each(settings, function eachSetting(setting, settingName) {
|
||||||
setting.type = categoryName;
|
|
||||||
setting.group = categoryName;
|
setting.group = categoryName;
|
||||||
setting.key = settingName;
|
setting.key = settingName;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue