# Configurations

The application configuration lives in the ./config folder (see project structure). All the configuration files are loaded on startup and can be accessed through the configuration provider.

If the ./config/server.js file has the following config:

module.exports = {
  host: '0.0.0.0',
};
1
2
3

The server.host key can be accessed as:

strapi.config.get('server.host', 'defaultValueIfUndefined');
1

Nested keys are accessible with the dot notation (opens new window).

✏️ NOTE

The filename is used as a prefix to access the configurations.

Configuration files can either be .js or .json files.

When using a .js file, the configuration can be exported:

  • either as an object:

    module.exports = {
      mySecret: 'someValue',
    };
    
    1
    2
    3
  • or as a function returning a configuration object (recommended usage). The function will get access to the env utility:

    module.exports = ({ env }) => {
      return {
        mySecret: 'someValue',
      };
    };
    
    1
    2
    3
    4
    5

# Required configurations

Some parts of Strapi must be configured for the Strapi application to work properly:

# Optional configurations

Strapi also offers the following optional configuration options for specific features: