Config.php structure

Do you have a structure in your config.php or do you just dump everything in that file?

This is my config.php structure

c::set('license', 'my_license_key');

include kirby()->roots()->config() . '/routes.php';
include kirby()->roots()->config() . '/language.php';
include kirby()->roots()->config() . '/thumbs.php';
include kirby()->roots()->config() . '/panel.php';

Except for this general config.php I use multiple config files for each environment:

http://getkirby.com/blog/multi-environment-setup

How do you do it?

So far I’ve only used an external config file for the license. But I only manage simple Kirby sites at the moment.

It’s a common advise is to leave configuration files like config.php for server settings only and ignore them on versioned projects (Hello Drupal 6 language strings!).

The most reasonable approach to config management on Kirby would be to include the multi-enviroment setup e.g. for a local, test and live server. I found these to differ in terms of debug messages and configuration paths for image libs (point 2 below).

With the license taken into account, there are 3 configuration parts to account for:

  1. project-wide settings like language, panel and markdown options – we want these to sync and be visible on a public repo
  2. server-specific settings that are needed for development
  3. license – the only project-wide setting that shouldn’t be disclosed, right?

This doesn’t take into account fiddling with subdomains and several content folders – I’m not sure this is common anyway.

So one could create a public fallback config.php with include() to a public settings.php – the latter also including the ignored license.php.
For development, further multi-enviroment config files are added – they also include() the general settings (and thereby the license, if available) but allow for further fiddling and can be ignored on public repos.

Mhh … I somehow have the feeling that this is too much opinion for such a general topic. The confusion starts with labels – what’s “settings”, what “configuration”?

… is very old (Jan 03 2012).

The actual version we can find at Kirby Docs: Advanced > Options > Multi-environment setup