Configuration

Introduction

Configuration files specific to your Ride project will be stored in the application/config directory.

Any modules you're using can have their own settings in their own config directory. You can override module settings in your project configuration, as the later will taken precedent over any modules.

Accessing configuration values

Environment Configuration

Environments are a way to have different configuration parameters based on the environment is running in.

For example, you can use different database credentials on your local machine and on the production or staging server. Ride made it very easy to setup different environments.

The default environment is dev and is set in the application/config/parameters.php file. In this file you can define different environments based on the path. The switch usually looks the following:

$environment = "dev";
$willCacheConfig = false;

// detect environment based on path
switch (__DIR__) {
    case "/dir/to/project/root/application/config":
        $environment = "prod";
        $willCacheConfig = true;

        break;
    case "/dir/to/project/root/application/config":
        $environment = "stag";
        $willCacheConfig = true;

        break;
}

To overwrite the existing parameters for a specific environment, create a parameters.json file in the the directory corresponding to your environment, for example:

/dir/to/project/root/application/config/envname/parameters.json.

If you want to overwrite parameters for your dev environment you should create a parameters.json in a dev folder: /dir/to/project/root/application/config/dev/parameters.json.