mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	Merge branch 'master' into fix/docs-config-database
This commit is contained in:
		
						commit
						0ebd0d5842
					
				| @ -332,6 +332,11 @@ Most of the application's configurations are defined by environment. It means th | |||||||
|  - `port` (integer): Port on which the server should be running. Default value: `1337`. |  - `port` (integer): Port on which the server should be running. Default value: `1337`. | ||||||
|  - `autoReload` |  - `autoReload` | ||||||
|    - `enabled` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment. |    - `enabled` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment. | ||||||
|  |  - `proxy` | ||||||
|  |   - `enabled` (boolean): Enable proxy support such as Apache or Nginx. Default value: `false`. | ||||||
|  |   - `ssl` (boolean): Enable proxy SSL support | ||||||
|  |   - `host` (string): Host name your proxy service uses for Strapi. | ||||||
|  |   - `port` (integer): Port that your proxy service accepts connections on. | ||||||
|  - [`cron`](https://en.wikipedia.org/wiki/Cron) |  - [`cron`](https://en.wikipedia.org/wiki/Cron) | ||||||
|   - `enabled` (boolean): Enable or disable CRON tasks to schedule jobs at specific dates. Default value: `false`. |   - `enabled` (boolean): Enable or disable CRON tasks to schedule jobs at specific dates. Default value: `false`. | ||||||
|  - `admin` |  - `admin` | ||||||
| @ -343,6 +348,33 @@ Most of the application's configurations are defined by environment. It means th | |||||||
|         - `source` (string): Define the source mode (origin, host, custom). |         - `source` (string): Define the source mode (origin, host, custom). | ||||||
|         - `folder` (string): Indicate what the plugins folder in `host` source mode. |         - `folder` (string): Indicate what the plugins folder in `host` source mode. | ||||||
| 
 | 
 | ||||||
|  | #### Example | ||||||
|  | 
 | ||||||
|  | **Path —** `./config/environments/**/server.json`. | ||||||
|  | 
 | ||||||
|  | As an example using this configuration with Nginx your server would respond to `https://example.com:8443` instead of `http://localhost:1337` | ||||||
|  | 
 | ||||||
|  | **Note:** you will need to configure Nginx or Apache as a proxy before configuring this example. | ||||||
|  | 
 | ||||||
|  | ```json | ||||||
|  | { | ||||||
|  |   "host": "localhost", | ||||||
|  |   "port": 1337, | ||||||
|  |   "proxy": { | ||||||
|  |     "enabled": true, | ||||||
|  |     "ssl": true, | ||||||
|  |     "host": "example.com", | ||||||
|  |     "port": 8443 | ||||||
|  |   }, | ||||||
|  |   "autoReload": { | ||||||
|  |     "enabled": true | ||||||
|  |   }, | ||||||
|  |   "cron": { | ||||||
|  |     "enabled": true | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
| *** | *** | ||||||
| 
 | 
 | ||||||
| ## Dynamic configurations | ## Dynamic configurations | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| { | { | ||||||
|   "host": "localhost", |   "host": "localhost", | ||||||
|   "port": 1337, |   "port": 1337, | ||||||
|  |   "proxy": { | ||||||
|  |     "enabled": false | ||||||
|  |   }, | ||||||
|   "autoReload": { |   "autoReload": { | ||||||
|     "enabled": true |     "enabled": true | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| { | { | ||||||
|   "host": "localhost", |   "host": "localhost", | ||||||
|   "port": "${process.env.PORT || 1337}", |   "port": "${process.env.PORT || 1337}", | ||||||
|  |   "proxy": { | ||||||
|  |     "enabled": false | ||||||
|  |   }, | ||||||
|   "autoReload": { |   "autoReload": { | ||||||
|     "enabled": false |     "enabled": false | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| { | { | ||||||
|   "host": "localhost", |   "host": "localhost", | ||||||
|   "port": "${process.env.PORT || 1337}", |   "port": "${process.env.PORT || 1337}", | ||||||
|  |   "proxy": { | ||||||
|  |     "enabled": false | ||||||
|  |   }, | ||||||
|   "autoReload": { |   "autoReload": { | ||||||
|     "enabled": false |     "enabled": false | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -107,6 +107,12 @@ | |||||||
|   "form.server.item.port": "Port", |   "form.server.item.port": "Port", | ||||||
|   "form.server.item.cron": "Cron", |   "form.server.item.cron": "Cron", | ||||||
| 
 | 
 | ||||||
|  |   "form.server.item.proxy": "Proxy Settings", | ||||||
|  |   "form.server.item.proxy.enable": "Proxy Enable", | ||||||
|  |   "form.server.item.proxy.ssl": "Proxy SSL", | ||||||
|  |   "form.server.item.proxy.host": "Proxy Host", | ||||||
|  |   "form.server.item.proxy.port": "Proxy Port", | ||||||
|  | 
 | ||||||
|   "form.language.name": "Languages", |   "form.language.name": "Languages", | ||||||
|   "form.language.description": "Configure your languages.", |   "form.language.description": "Configure your languages.", | ||||||
|   "form.language.choose": "Choose a language:", |   "form.language.choose": "Choose a language:", | ||||||
|  | |||||||
| @ -452,6 +452,41 @@ module.exports = { | |||||||
|             value: _.get(strapi.config, `environments.${env}.server.cron.enabled`, null) |             value: _.get(strapi.config, `environments.${env}.server.cron.enabled`, null) | ||||||
|           } |           } | ||||||
|         ] |         ] | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         name: 'form.server.item.proxy', | ||||||
|  |         items: [ | ||||||
|  |           { | ||||||
|  |             name: 'form.server.item.proxy.enable', | ||||||
|  |             target: 'server.proxy.enabled', | ||||||
|  |             type: 'boolean', | ||||||
|  |             value: _.get(strapi.config, `environments.${env}.server.proxy.enabled`, null), | ||||||
|  |             items: [ | ||||||
|  |               { | ||||||
|  |                 name: 'form.server.item.proxy.host', | ||||||
|  |                 target: 'server.proxy.host', | ||||||
|  |                 type: 'string', | ||||||
|  |                 value: _.get(strapi.config, `environments.${env}.server.proxy.host`, null), | ||||||
|  |                 validations: {} | ||||||
|  |               }, | ||||||
|  |               { | ||||||
|  |                 name: 'form.server.item.proxy.port', | ||||||
|  |                 target: 'server.proxy.port', | ||||||
|  |                 type: 'number', | ||||||
|  |                 value: _.get(strapi.config, `environments.${env}.server.proxy.port`, null), | ||||||
|  |                 validations: {} | ||||||
|  |               }, | ||||||
|  |               { | ||||||
|  |                 name: 'form.server.item.proxy.ssl', | ||||||
|  |                 target: 'server.proxy.ssl', | ||||||
|  |                 type: 'boolean', | ||||||
|  |                 value: _.get(strapi.config, `environments.${env}.server.proxy.ssl`, null), | ||||||
|  |                 validations: {} | ||||||
|  |               } | ||||||
|  |             ], | ||||||
|  |             validations: {} | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|       } |       } | ||||||
|     ] |     ] | ||||||
|   }), |   }), | ||||||
|  | |||||||
| @ -318,9 +318,25 @@ module.exports.app = async function() { | |||||||
|     return acc; |     return acc; | ||||||
|   }, {}); |   }, {}); | ||||||
| 
 | 
 | ||||||
|  |   // default settings
 | ||||||
|   this.config.port = get(this.config.currentEnvironment, 'server.port') || this.config.port; |   this.config.port = get(this.config.currentEnvironment, 'server.port') || this.config.port; | ||||||
|   this.config.host = get(this.config.currentEnvironment, 'server.host') || this.config.host; |   this.config.host = get(this.config.currentEnvironment, 'server.host') || this.config.host; | ||||||
|   this.config.url = `http://${this.config.host}:${this.config.port}`; | 
 | ||||||
|  |   // default construct url
 | ||||||
|  |   this.config.url = `http://${this.config.host}:${this.config.port}` | ||||||
|  | 
 | ||||||
|  |   // proxy settings
 | ||||||
|  |   this.config.proxy = get(this.config.currentEnvironment, 'server.proxy' || {}); | ||||||
|  | 
 | ||||||
|  |   // check if SSL enabled and construct proxy url
 | ||||||
|  |   function getProxyUrl(ssl, url) { | ||||||
|  |     return `http${ssl ? 's' : ''}://${url}`; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // check if proxy is enabled and construct url
 | ||||||
|  |   if (get(this.config, 'proxy.enabled')) { | ||||||
|  |     this.config.url = getProxyUrl(this.config.proxy.ssl, `${this.config.proxy.host}:${this.config.proxy.port}`); | ||||||
|  |   } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const enableHookNestedDependencies = function (name, flattenHooksConfig, force = false) { | const enableHookNestedDependencies = function (name, flattenHooksConfig, force = false) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jim LAURIE
						Jim LAURIE