The main configurations of the project are located in the `./config` directory. Additional configs can be added in the `./api/**/config` folder of each API and plugin by creating JavaScript or JSON files.
## Application
Contains the main configurations relative to your project.
As described in the [i18n documentation](../guides/i18n.md), Strapi includes an internationalization system. This is especially useful to translate API messages (errors, etc.).
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).
The `locales` directory contains the translations of your API.
Each JSON file located in the folder must have the name of its corresponding translation (eg. `en_US.json`, `fr_FR.json`, etc.). Each line defines a translation key and its corresponding value.
Most of the application's configurations are defined by environment. It means that you can specify settings for each environment (`development`, `production`, `test`, etc.).
::: note
You can access the config of the current environment through `strapi.config.currentEnvironment`.
-`username` (string): Username used to establish the connection.
-`password` (string): Password used to establish the connection.
-`options` (object): List of additional options used by the connector.
-`timezone` (string): Set the default behavior for local time (used only for a SQL database). Default value: `utc`.
-`schema` (string): Set the default database schema. (used only for Postgres DB)
-`options` Options used for database connection.
-`ssl` (boolean): For ssl database connection.
-`debug` (boolean): Show database exchanges and errors.
-`autoMigration` (boolean): To disable auto tables/columns creation for SQL database.
-`pool` Options used for database connection pooling. For more information look at [Knex's pool config documentation](https://knexjs.org/#Installation-pooling).
-`min` (integer): Minimum number of connections to keep in the pool. Default value: `0`.
-`max` (integer): Maximum number of connections to keep in the pool. Default value: `10`.
-`acquireTimeoutMillis` (integer): Maximum time in milliseconds to wait for acquiring a connection from the pool. Default value: `2000` (2 seconds).
-`createTimeoutMillis` (integer): Maximum time in milliseconds to wait for creating a connection to be added to the pool. Default value: `2000` (2 seconds).
-`idleTimeoutMillis` (integer): Number of milliseconds to wait before destroying idle connections. Default value: `30000` (30 seconds).
-`reapIntervalMillis` (integer): How often to check for idle connections in milliseconds. Default value: `1000` (1 second).
-`createRetryIntervalMillis` (integer): How long to idle after a failed create before trying again in milliseconds. Default value: `200`.
-`expose` (array): Configures the `Access-Control-Expose-Headers` CORS header. If not specified, no custom headers are exposed. Default value: `["WWW-Authenticate", "Server-Authorization"]`.
-`maxAge` (integer): Configures the `Access-Control-Max-Age` CORS header. Default value: `31536000`.
-`credentials` (boolean): Configures the `Access-Control-Allow-Credentials` CORS header. Default value: `true`.
-`methods` (array)|String - Configures the `Access-Control-Allow-Methods` CORS header. Default value: `["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]`.
-`headers` (array): Configures the `Access-Control-Allow-Headers` CORS header. If not specified, defaults to reflecting the headers specified in the request's Access-Control-Request-Headers header. Default value: `["Content-Type", "Authorization", "X-Frame-Options"]`.
-`ip`
-`enabled` (boolean): Enable or disable IP blocker. Default value: `false`.
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
},
"cron": {
"enabled": true
}
}
```
## Dynamic configurations
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.
### Syntax
The syntax is inspired by the [template literals ES2015 specifications](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals). These dynamic values are indicated by the Dollar sign and curly braces (`${expression}`).
#### Usage
In any JSON configurations files in your project, you can inject dynamic values like this:
-`environment` (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).
-`type` (string): Sets if your config is for an `api`, `plugin` or `core`. By default it's `core`.
-`name` (string): You have to set the plugin or api name if `type` is `api` or `plugin`.
-`key` (string, required): The name of the key you want to store.