Configuration files are written in YAML. This allows configuration files to be easily written and understood by everyone.
LexasCMS uses an extension and inheritance approach to configuration. Configs are loaded in three stages, with each stage extending the previous. The three stages are:
The base configuration is provided by LexasCMS itself and defines defaults for a majority of the systems functionality. For example, this is where the default database configuration is defined as SQLite.
The default configuration is provided by you, it extends from the base configuration and can be used to define defaults specific to your website. This configuration stage is useful for defining configs that will be same for all environments, for example, in a majority of cases assets will be the same across all of your environments.
Config files that you would like to be loaded in this stage should be placed in the
config/default/ directory, e.g.
Environment specific configurations are provided by you, this stage extends from the
default configuration and allows you to define configs that are specific to a particular environment. For example, you would probably want to use a different database configuration for staging and production environments than you would in your development environment. This would be achieved by defining
database.yaml files at
These config files would then be loaded when the environment had been configured (see Environment Configuration) as either
For many reasons, you may not always be able to define config values statically and may require that values are defined dynamically at run time. For these situations you have several methods available for retrieving values from other sources.
Loading a value from an environment variable is very common. It is good security practice to store sensitive information such as API keys in environment variables instead of directly in config files. This method will usually be preferred by many PaaS hosting environments such as Heroku.
It is also possible to load the contents of a file as the value for a config key.
If the file you are loading the value from contains JSON, you can use the
JSONKEY prefix to use a particular keys value as the config value.
If the file you are loading the value from contains YAML, you can use the
YAMLKEY prefix to use a particular keys value as the config value.