# Access configuration values

> Source: https://docs.strapi.io/cms/configurations/guides/access-configuration-values

Access configuration values loaded on startup using the `strapi.config.get()` method with dot notation for nested keys across all configuration files.

All the [configuration files](/cms/configurations) are loaded on startup and can be accessed through the `strapi.config` configuration provider.

If the `/config/server.ts|js` file has the following configuration:

```js
  module.exports = {
    host: '0.0.0.0',
  };
  ```

```ts
  export default {
    host: '0.0.0.0',
  };
  ```

then the `server.host` key can be accessed as:

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

Nested keys are accessible with the [dot notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors#dot_notation).

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

Configuration files can either be `.js`, `.ts`, or `.json` files.

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

- either as an object:

  ```js
  module.exports = {
    mySecret: 'someValue',
  };
  ```

  ```ts
  export default {
    mySecret: 'someValue',
  };
  ```

- or as a function returning a configuration object (recommended usage). The function will get access to the [`env` utility](/cms/configurations/guides/access-cast-environment-variables):

  ```js
  module.exports = ({ env }) => {
    return {
      mySecret: env('MY_SECRET_KEY', 'defaultSecretValue'),
    };
  };
  ```

  ```ts
  export default ({ env }) => {
    return {
      mySecret: env('MY_SECRET_KEY', 'defaultSecretValue'),
    };
  };
  ```
