mirror of
https://github.com/strapi/strapi.git
synced 2025-08-19 14:19:03 +00:00
1 line
60 KiB
JavaScript
1 line
60 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[37],{202:function(t,s,e){"use strict";e.r(s);var a=e(0),n=Object(a.a)({},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"content"},[t._m(0),t._v(" "),t._m(1),t._v(" "),t._m(2),t._v(" "),e("p",[t._v("Contains the main configurations relative to your project.")]),t._v(" "),t._m(3),t._v(" "),t._m(4),t._m(5),t._v(" "),e("hr"),t._v(" "),t._m(6),t._v(" "),t._m(7),t._v(" "),t._m(8),t._v(" "),t._m(9),t._v(" "),t._m(10),t._m(11),t._v(" "),e("hr"),t._v(" "),t._m(12),t._v(" "),e("p",[t._v("As described in the "),e("router-link",{attrs:{to:"./../plugin-development/frontend-development.html#i18n"}},[t._v("i18n documentation")]),t._v(", Strapi includes an internationalization system. This is especially useful to translate API messages (errors, etc.).")],1),t._v(" "),t._m(13),t._v(" "),t._m(14),t._m(15),t._v(" "),e("hr"),t._v(" "),t._m(16),t._v(" "),t._m(17),t._v(" "),t._m(18),t._v(" "),t._m(19),t._v(" "),t._m(20),t._v(" "),e("p",[t._v("Here are some use cases:")]),t._v(" "),t._m(21),t._v(" "),t._m(22),t._v(" "),e("p",[t._v("CRON tasks allow you to schedule jobs (arbitrary functions) for execution at specific dates, with optional recurrence rules. It only uses a single timer at any given time (rather than reevaluating upcoming jobs every second/minute).")]),t._v(" "),t._m(23),t._v(" "),e("p",[t._v("The cron format consists of:")]),t._v(" "),t._m(24),e("p",[t._v("To define a CRON job, add your logic like bellow:")]),t._v(" "),t._m(25),t._v(" "),t._m(26),e("hr"),t._v(" "),t._m(27),t._v(" "),t._m(28),t._v(" "),t._m(29),t._v(" "),t._m(30),t._v(" "),t._m(31),t._v(" "),t._m(32),e("blockquote",[e("p",[t._v("Take a look at the "),e("router-link",{attrs:{to:"./../guides/i18n.html"}},[t._v("internationalization's guide")]),t._v(" for more details.")],1)]),t._v(" "),e("hr"),t._v(" "),t._m(33),t._v(" "),t._m(34),t._v(" "),t._m(35),t._v(" "),e("hr"),t._v(" "),t._m(36),t._v(" "),t._m(37),t._v(" "),t._m(38),t._v(" "),t._m(39),t._v(" "),t._m(40),t._v(" "),t._m(41),t._m(42),t._v(" "),e("hr"),t._v(" "),t._m(43),t._v(" "),t._m(44),t._v(" "),t._m(45),t._v(" "),t._m(46),t._v(" "),e("hr"),t._v(" "),t._m(47),t._v(" "),t._m(48),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Gzip",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("gzip")]),e("OutboundLink")],1)]),t._v(" "),t._m(49),t._v(" "),t._m(50),t._v(" "),t._m(51)]),t._v(" "),e("hr"),t._v(" "),t._m(52),t._v(" "),t._m(53),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Cross-site_request_forgery",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("csrf")]),e("OutboundLink")],1),t._v(" "),t._m(54)]),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Content_Security_Policy",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("csp")]),e("OutboundLink")],1),t._v(" "),t._m(55)]),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/P3P",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("p3p")]),e("OutboundLink")],1)]),t._v(" "),t._m(56),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("hsts")]),e("OutboundLink")],1)]),t._v(" "),t._m(57),t._v(" "),t._m(58),t._v(" "),t._m(59),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Clickjacking",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("xframe")]),e("OutboundLink")],1),t._v(" "),t._m(60)]),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Cross-site_scripting",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("xss")]),e("OutboundLink")],1)]),t._v(" "),t._m(61),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Cross-origin_resource_sharing",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("cors")]),e("OutboundLink")],1)]),t._v(" "),t._m(62),t._v(" "),t._m(63),t._v(" "),t._m(64),t._v(" "),t._m(65),t._v(" "),t._m(66),t._v(" "),t._m(67),t._v(" "),t._m(68),t._v(" "),t._m(69)]),t._v(" "),e("hr"),t._v(" "),t._m(70),t._v(" "),t._m(71),t._v(" "),e("ul",[t._m(72),t._v(" "),t._m(73),t._v(" "),t._m(74),t._v(" "),e("li",[e("a",{attrs:{href:"https://en.wikipedia.org/wiki/Cron",target:"_blank",rel:"noopener noreferrer"}},[e("code",[t._v("cron")]),e("OutboundLink")],1)]),t._v(" "),t._m(75),t._v(" "),t._m(76),t._v(" "),t._m(77),t._v(" "),t._m(78)]),t._v(" "),e("hr"),t._v(" "),t._m(79),t._v(" "),e("p",[t._v("For security reasons, sometimes it's better to set variables through the server environment. It's also useful to push dynamics values into configurations files. To enable this feature into JSON files, Strapi embraces a JSON-file interpreter into his core to allow dynamic value in the JSON configurations files.")]),t._v(" "),t._m(80),t._v(" "),e("p",[t._v("The syntax is inspired by the "),e("a",{attrs:{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals",target:"_blank",rel:"noopener noreferrer"}},[t._v("template literals ES2015 specifications"),e("OutboundLink")],1),t._v(". These dynamic values are indicated by the Dollar sign and curly braces ("),e("code",[t._v("${expression}")]),t._v(").")]),t._v(" "),t._m(81),t._v(" "),e("p",[t._v("In any JSON configurations files in your project, you can inject dynamic values like this:")]),t._v(" "),t._m(82),t._v(" "),t._m(83),t._m(84),t._v(" "),e("hr"),t._v(" "),t._m(85),t._v(" "),e("p",[t._v("Configuration files are not multi server friendly. So we create a data store for config you will want to update in production.")]),t._v(" "),t._m(86),t._v(" "),t._m(87),t._v(" "),t._m(88),t._v(" "),t._m(89),t._m(90),t._v(" "),t._m(91),t._v(" "),t._m(92)])},[function(){var t=this.$createElement,s=this._self._c||t;return s("h1",{attrs:{id:"configurations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#configurations","aria-hidden":"true"}},[this._v("#")]),this._v(" Configurations")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("The main configurations of the project are located in the "),s("code",[this._v("./config")]),this._v(" directory. Additional configs can be added in the "),s("code",[this._v("./api/**/config")]),this._v(" folder of each API and plugin by creating JavaScript or JSON files.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"application"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#application","aria-hidden":"true"}},[this._v("#")]),this._v(" Application")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/application.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"favicon"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"path"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"favicon.ico"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"maxAge"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("86400000")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"public"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"path"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"./public"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"maxAge"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("60000")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("favicon")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("path")]),t._v(" (string): Path to the favicon file. Default value: "),e("code",[t._v("favicon.ico")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("maxAge")]),t._v(" (integer): Cache-control max-age directive in ms. Default value: "),e("code",[t._v("86400000")]),t._v(".")])])]),t._v(" "),e("li",[e("code",[t._v("public")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("path")]),t._v(" (string): Path to the public folder. Default value: "),e("code",[t._v("./public")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("maxAge")]),t._v(" (integer): Cache-control max-age directive in ms. Default value: "),e("code",[t._v("60000")]),t._v(".")])])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"custom"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#custom","aria-hidden":"true"}},[this._v("#")]),this._v(" Custom")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("Add custom configurations to the project. The content of this file is available through the "),s("code",[this._v("strapi.config")]),this._v(" object.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#example","aria-hidden":"true"}},[this._v("#")]),this._v(" Example")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/custom.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"backendURL"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"http://www.strapi.io"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"mainColor"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"blue"')]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("These configurations are accessible through "),s("code",[this._v("strapi.config.backendURL")]),this._v(" and "),s("code",[this._v("strapi.config.mainColor")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"language"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#language","aria-hidden":"true"}},[this._v("#")]),this._v(" Language")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/language.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"enabled"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token boolean"}},[t._v("true")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"defaultLocale"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"en_us"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"modes"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"query"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"subdomain"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"cookie"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"header"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"url"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"tld"')]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"cookieName"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"locale"')]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("enabled")]),t._v(" (boolean): Enable or disable i18n. Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("defaultLocale")]),t._v(" (string): Default locale used by the application. Default value: "),e("code",[t._v("en_us")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("modes")]),t._v(" (array): Methods used to detect client language. Default value: "),e("code",[t._v('["query", "subdomain", "cookie", "header", "url", "tld"]')]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("cookieName")]),t._v(" (string): Name of the cookie used to store the locale name. Default value: "),e("code",[t._v("locale")]),t._v(".")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"functions"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#functions","aria-hidden":"true"}},[this._v("#")]),this._v(" Functions")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("The "),s("code",[this._v("./config/functions/")]),this._v(" folder contains a set of JavaScript files in order to add dynamic and logic based configurations.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",{attrs:{id:"bootstrap"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#bootstrap","aria-hidden":"true"}},[this._v("#")]),this._v(" Bootstrap")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/functions/bootstrap.js")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("The "),s("code",[this._v("bootstrap")]),this._v(" function is called at every server start. You can use it to add a specific logic at this moment of your server's lifecycle.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("ul",[s("li",[this._v("Create an admin user if there isn't.")]),this._v(" "),s("li",[this._v("Fill the database with some necessary data.")]),this._v(" "),s("li",[this._v("Check that the database is up-and-running.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",{attrs:{id:"cron-tasks"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#cron-tasks","aria-hidden":"true"}},[this._v("#")]),this._v(" CRON tasks")])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"note custom-block"},[s("p",[this._v("Make sure the "),s("code",[this._v("enabled")]),this._v(" cron config is set to "),s("code",[this._v("true")]),this._v(" in your environment's variables.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[this._v("* * * * * *\n┬ ┬ ┬ ┬ ┬ ┬\n│ │ │ │ │ |\n│ │ │ │ │ └ day of week (0 - 7) (0 or 7 is Sun)\n│ │ │ │ └───── month (1 - 12)\n│ │ │ └────────── day of month (1 - 31)\n│ │ └─────────────── hour (0 - 23)\n│ └──────────────────── minute (0 - 59)\n└───────────────────────── second (0 - 59, OPTIONAL)\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/functions/cron.js")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[t._v("module"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("exports "),e("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),e("span",{attrs:{class:"token comment"}},[t._v("/**\n * Simple example.\n * Every monday at 1am.\n */")]),t._v("\n\n "),e("span",{attrs:{class:"token string"}},[t._v("'0 0 1 * * 1'")]),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token comment"}},[t._v("// Add your own logic here (eg. send a queue of email, create a database backup, etc.).")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"locales"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#locales","aria-hidden":"true"}},[this._v("#")]),this._v(" Locales")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("The "),s("code",[this._v("locales")]),this._v(" directory contains the translations of your API.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("Each JSON file located in the folder must have the name of its corresponding translation (eg. "),s("code",[this._v("en_US.json")]),this._v(", "),s("code",[this._v("fr_FR.json")]),this._v(", etc.). Each line defines a translation key and its corresponding value.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"example-2"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#example-2","aria-hidden":"true"}},[this._v("#")]),this._v(" Example")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/locales/en_US.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token string"}},[t._v('"welcome"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"Welcome"')]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"environments"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#environments","aria-hidden":"true"}},[this._v("#")]),this._v(" Environments")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("Most of the application's configurations are defined by environment. It means that you can specify settings for each environment ("),s("code",[this._v("development")]),this._v(", "),s("code",[this._v("production")]),this._v(", "),s("code",[this._v("test")]),this._v(", etc.).")])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"note custom-block"},[s("p",[this._v("You can access the config of the current environment through "),s("code",[this._v("strapi.config.currentEnvironment")]),this._v(".")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"database"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#database","aria-hidden":"true"}},[this._v("#")]),this._v(" Database")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/database.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("defaultConnection")]),t._v(" (string): Connection by default for models which are not related to a specific "),e("code",[t._v("connection")]),t._v(". Default value: "),e("code",[t._v("default")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("connections")]),t._v(" List of all available connections.\n"),e("ul",[e("li",[e("code",[t._v("default")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("connector")]),t._v(" (string): Connector used by the current connection. Default value: "),e("code",[t._v("strapi-hook-mongoose")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("client")]),t._v(" (string): Client used to store session. Default value: "),e("code",[t._v("cookie")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("key")]),t._v(" (string): Cookie key name. Default value: "),e("code",[t._v("strapi.sid")])]),t._v(" "),e("li",[e("code",[t._v("maxAge")]),t._v(" (integer): Time in milliseconds before the session expire. Default value: "),e("code",[t._v("86400000")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("rolling")]),t._v(" (boolean): Force a session identifier cookie to be set on every response. Default value: "),e("code",[t._v("false")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("signed")]),t._v(" (boolean): httpOnly or not. Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("overwrite")]),t._v(" (boolean): Can overwrite or not. Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("settings")]),t._v(" Useful for external session stores such as Redis.\n"),e("ul",[e("li",[e("code",[t._v("host")]),t._v(" (string): Database host name. Default value: "),e("code",[t._v("localhost")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("port")]),t._v(" (integer): Database port. Default value: "),e("code",[t._v("27017")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("database")]),t._v(" (string): Database name. Default value: "),e("code",[t._v("development")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("username")]),t._v(" (string): Username used to establish the connection.")]),t._v(" "),e("li",[e("code",[t._v("password")]),t._v(" (string): Password used to establish the connection.")]),t._v(" "),e("li",[e("code",[t._v("options")]),t._v(" (object): List of additional options used by the connector.")]),t._v(" "),e("li",[e("code",[t._v("timezone")]),t._v(" (string): Set the default behavior for local time (used only for a SQL database). Default value: "),e("code",[t._v("utc")]),t._v(".")])])])])]),t._v(" "),e("li",[e("code",[t._v("options")]),t._v(" Options used for database connection.\n"),e("ul",[e("li",[e("code",[t._v("ssl")]),t._v(" (boolean): For ssl database connection.")]),t._v(" "),e("li",[e("code",[t._v("debug")]),t._v(" (boolean): Show database exchanges and errors.")]),t._v(" "),e("li",[e("code",[t._v("autoMigration")]),t._v(" (boolean): To disable auto tables/columns creation for SQL database.")])])])])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"example-3"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#example-3","aria-hidden":"true"}},[this._v("#")]),this._v(" Example")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/database.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"defaultConnection"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"default"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connections"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"default"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connector"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi-hook-mongoose"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"settings"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"client"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"mongo"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"host"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"localhost"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"port"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("27017")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"database"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"development"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"username"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"fooUsername"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"password"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"fooPwd"')]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"options"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"authenticationDatabase"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('""')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"ssl"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token boolean"}},[t._v("true")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"minimize"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token boolean"}},[t._v("true")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"postgres"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connector"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi-hook-bookshelf"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"settings"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"client"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"postgres"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"host"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"localhost"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"port"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("5432")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"username"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"${process.env.USERNAME}"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"password"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"${process.env.PWD}"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"database"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"schema"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"public"')]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"options"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"debug"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token boolean"}},[t._v("true")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"mysql"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connector"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi-hook-bookshelf"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"settings"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"client"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"mysql"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"host"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"localhost"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"port"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("5432")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"username"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"password"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"root"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"database"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('""')]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"options"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"redis"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connector"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi-redis"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"settings"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"port"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token number"}},[t._v("6379")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"host"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"localhost"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"password"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('""')]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"options"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"debug"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token boolean"}},[t._v("false")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("blockquote",[s("p",[this._v("Please refer to the "),s("a",{attrs:{href:"#dynamic-configurations"}},[this._v("dynamic configurations section")]),this._v(" to use global environment variable to configure the databases.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"request"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#request","aria-hidden":"true"}},[this._v("#")]),this._v(" Request")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/request.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("session")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("enabled")]),t._v(" (boolean): Enable or disable sessions. Default value: "),e("code",[t._v("false")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("client")]),t._v(" (string): Client used to persist sessions. Default value: "),e("code",[t._v("redis")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("settings")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("host")]),t._v(" (string): Client host name. Default value: "),e("code",[t._v("localhost")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("port")]),t._v(" (integer): Client port. Default value: "),e("code",[t._v("6379")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("database")]),t._v("(integer)|String - Client database name. Default value: "),e("code",[t._v("10")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("password")]),t._v(" (string): Client password. Default value: "),e("code"),t._v(".")])])])])]),t._v(" "),e("li",[e("code",[t._v("logger")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("level")]),t._v(" (string): Default log level. Default value: "),e("code",[t._v("debug")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("exposeInContext")]),t._v(" (boolean): Expose logger in context so it can be used through "),e("code",[t._v("strapi.log.info(‘my log’)")]),t._v(". Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("requests")]),t._v(" (boolean): Enable or disable requests logs. Default value: "),e("code",[t._v("false")]),t._v(".")])])]),t._v(" "),e("li",[e("code",[t._v("parser")])]),t._v(" "),e("li",[e("code",[t._v("enabled")]),t._v("(boolean): Enable or disable parser. Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("multipart")]),t._v(" (boolean): Enable or disable multipart bodies parsing. Default value: "),e("code",[t._v("true")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("router")])]),t._v(" "),e("li",[e("code",[t._v("prefix")]),t._v(" (string): API url prefix (eg. "),e("code",[t._v("/v1")]),t._v(").")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"note custom-block"},[s("p",[this._v("The session doesn't work with "),s("code",[this._v("mongo")]),this._v(" as a client. The package that we should use is broken for now.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"response"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#response","aria-hidden":"true"}},[this._v("#")]),this._v(" Response")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/response.json")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or not GZIP response compression.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("responseTime")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or not "),s("code",[this._v("X-Response-Time header")]),this._v(" to response. Default value: "),s("code",[this._v("false")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"security"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#security","aria-hidden":"true"}},[this._v("#")]),this._v(" Security")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/security.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("enabled")]),t._v(" (boolean): Enable or disable CSRF. Default value: depends on the environment.")]),t._v(" "),e("li",[e("code",[t._v("key")]),t._v(" (string): The name of the CSRF token added to the model. Default value: "),e("code",[t._v("_csrf")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("secret")]),t._v(" (string): The key to place on the session object which maps to the server side token. Default value: "),e("code",[t._v("_csrfSecret")]),t._v(".")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("ul",[s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable CSP to avoid Cross Site Scripting (XSS) and data injection attacks.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable p3p.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable HSTS.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("maxAge")]),this._v(" (integer): Number of seconds HSTS is in effect. Default value: "),s("code",[this._v("31536000")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("includeSubDomains")]),this._v(" (boolean): Applies HSTS to all subdomains of the host. Default value: "),s("code",[this._v("true")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("enabled")]),t._v(" (boolean): Enable or disable "),e("code",[t._v("X-FRAME-OPTIONS")]),t._v(" headers in response.")]),t._v(" "),e("li",[e("code",[t._v("value")]),t._v(" (string): The value for the header, e.g. DENY, SAMEORIGIN or ALLOW-FROM uri. Default value: "),e("code",[t._v("SAMEORIGIN")]),t._v(".")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable XSS to prevent Cross Site Scripting (XSS) attacks in older IE browsers (IE8).")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable CORS to prevent your server to be requested from another domain.")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("li",[e("code",[t._v("origin")]),t._v(" (string): Allowed URLs ("),e("code",[t._v("http://example1.com, http://example2.com")]),t._v(" or allows everyone "),e("code",[t._v("*")]),t._v("). Default value: "),e("code",[t._v("http://localhost")]),t._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("expose")]),this._v(" (array): Configures the "),s("code",[this._v("Access-Control-Expose-Headers")]),this._v(" CORS header. If not specified, no custom headers are exposed. Default value: "),s("code",[this._v('["WWW-Authenticate", "Server-Authorization"]')]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("maxAge")]),this._v(" (integer): Configures the "),s("code",[this._v("Access-Control-Max-Age")]),this._v(" CORS header. Default value: "),s("code",[this._v("31536000")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("credentials")]),this._v(" (boolean): Configures the "),s("code",[this._v("Access-Control-Allow-Credentials")]),this._v(" CORS header. Default value: "),s("code",[this._v("true")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("methods")]),this._v(" (array)|String - Configures the "),s("code",[this._v("Access-Control-Allow-Methods")]),this._v(" CORS header. Default value: "),s("code",[this._v('["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]')]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("headers")]),this._v(" (array): Configures the "),s("code",[this._v("Access-Control-Allow-Headers")]),this._v(" CORS header. If not specified, defaults to reflecting the headers specified in the request's Access-Control-Request-Headers header. Default value: "),s("code",[this._v('["Content-Type", "Authorization", "X-Frame-Options"]')]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("li",[e("code",[t._v("ip")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("enabled")]),t._v(" (boolean): Enable or disable IP blocker. Default value: "),e("code",[t._v("false")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("whiteList")]),t._v(" (array): Whitelisted IPs. Default value: "),e("code",[t._v("[]")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("blackList")]),t._v(" (array): Blacklisted IPs. Default value: "),e("code",[t._v("[]")]),t._v(".")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"server"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#server","aria-hidden":"true"}},[this._v("#")]),this._v(" Server")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/**/server.json")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("host")]),this._v(" (string): Host name. Default value: "),s("code",[this._v("localhost")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("port")]),this._v(" (integer): Port on which the server should be running. Default value: "),s("code",[this._v("1337")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("autoReload")]),this._v(" (boolean): Enable or disabled server reload on files update. Default value: depends on the environment.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("enabled")]),this._v(" (boolean): Enable or disable CRON tasks to schedule jobs at specific dates. Default value: "),s("code",[this._v("false")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("admin")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("li",[s("code",[this._v("path")]),this._v(" (string): Allow to change the URL to access the admin (default: "),s("code",[this._v("/admin")]),this._v(").")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("li",[e("code",[t._v("build")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("host")]),t._v(" (string): URL to access the admin panel (default: "),e("code",[t._v("http://localhost:1337/admin")]),t._v(").")]),t._v(" "),e("li",[e("code",[t._v("backend")]),t._v(" (string): URL that the admin panel and plugins will request (default: "),e("code",[t._v("http://localhost:1337")]),t._v(").\n"),e("ul",[e("li",[e("code",[t._v("plugins")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("source")]),t._v(" (string): Define the source mode (origin, host, custom).")]),t._v(" "),e("li",[e("code",[t._v("folder")]),t._v(" (string): Indicate what the plugins folder in "),e("code",[t._v("host")]),t._v(" source mode.")])])])])])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"dynamic-configurations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#dynamic-configurations","aria-hidden":"true"}},[this._v("#")]),this._v(" Dynamic configurations")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",{attrs:{id:"syntax"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#syntax","aria-hidden":"true"}},[this._v("#")]),this._v(" Syntax")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"usage"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#usage","aria-hidden":"true"}},[this._v("#")]),this._v(" Usage")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Path —")]),this._v(" "),s("code",[this._v("./config/environments/production/database.json")]),this._v(".")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"defaultConnection"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"default"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connections"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"default"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"connector"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"strapi-hook-mongoose"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"settings"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"client"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"mongo"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"uri"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("\"${process.env.DATABASE_URI || ''}\"")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"host"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("\"${process.env.DATABASE_HOST || '127.0.0.1'}\"")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"port"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v('"${process.env.DATABASE_PORT || 27017}"')]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"database"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("\"${process.env.DATABASE_NAME || 'production'}\"")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"username"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("\"${process.env.DATABASE_USERNAME || ''}\"")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"password"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("\"${process.env.DATABASE_PASSWORD || ''}\"")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{attrs:{class:"token property"}},[t._v('"options"')]),e("span",{attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"note custom-block"},[s("p",[this._v("You can't execute functions inside the curly braces. Only strings are allowed.")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"database-configuration"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#database-configuration","aria-hidden":"true"}},[this._v("#")]),this._v(" Database configuration")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"usage-2"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#usage-2","aria-hidden":"true"}},[this._v("#")]),this._v(" Usage")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"get-settings"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#get-settings","aria-hidden":"true"}},[this._v("#")]),this._v(" Get settings:")])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ul",[e("li",[e("code",[t._v("environment")]),t._v(" (string): Sets the environment you want to store the data in. By default it's current environment (can be an empty string if your config is environment agnostic).")]),t._v(" "),e("li",[e("code",[t._v("type")]),t._v(" (string): Sets if your config is for an "),e("code",[t._v("api")]),t._v(", "),e("code",[t._v("plugin")]),t._v(" or "),e("code",[t._v("core")]),t._v(". By default it's "),e("code",[t._v("core")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("name")]),t._v(" (string): You have to set the plugin or api name if "),e("code",[t._v("type")]),t._v(" is "),e("code",[t._v("api")]),t._v(" or "),e("code",[t._v("plugin")]),t._v(".")]),t._v(" "),e("li",[e("code",[t._v("key")]),t._v(" (string, required): The name of the key you want to store.")])])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{attrs:{class:"token comment"}},[t._v("// strapi.store(object).get(object);")]),t._v("\n\n"),e("span",{attrs:{class:"token comment"}},[t._v("// create reusable plugin store variable")]),t._v("\n"),e("span",{attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pluginStore "),e("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" strapi"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{attrs:{class:"token function"}},[t._v("store")]),e("span",{attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n environment"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" strapi"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("config"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("environment"),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n type"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'plugin'")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n name"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'users-permissions'")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),e("span",{attrs:{class:"token keyword"}},[t._v("await")]),t._v(" pluginStore"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{attrs:{class:"token keyword"}},[t._v("get")]),e("span",{attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("key"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'grant'")]),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"set-settings"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#set-settings","aria-hidden":"true"}},[this._v("#")]),this._v(" Set settings:")])},function(){var t=this.$createElement,s=this._self._c||t;return s("ul",[s("li",[s("code",[this._v("value")]),this._v(" (any, required): The value you want to store.")])])},function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{attrs:{class:"token comment"}},[t._v("// strapi.store(object).set(object);")]),t._v("\n\n"),e("span",{attrs:{class:"token comment"}},[t._v("// create reusable plugin store variable")]),t._v("\n"),e("span",{attrs:{class:"token keyword"}},[t._v("const")]),t._v(" pluginStore "),e("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" strapi"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{attrs:{class:"token function"}},[t._v("store")]),e("span",{attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n environment"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" strapi"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("config"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("environment"),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n type"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'plugin'")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n name"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'users-permissions'")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),e("span",{attrs:{class:"token keyword"}},[t._v("await")]),t._v(" pluginStore"),e("span",{attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{attrs:{class:"token keyword"}},[t._v("set")]),e("span",{attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n key"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token string"}},[t._v("'grant'")]),e("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n value"),e("span",{attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{attrs:{class:"token operator"}},[t._v("...")]),t._v("\n "),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])}],!1,null,null,null);n.options.__file="configurations.md";s.default=n.exports}}]); |