--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To post to this group, send email to silverst...@googlegroups.com.
To unsubscribe from this group, send email to silverstripe-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/silverstripe-dev?hl=en.
- Each fragment should start with a number, and each fragment will be included from lowest to highest, regardless of the module it's in. So it the demo, sapphire/_config/001-routes.yml is first, then sapphire/_config/010-routes.yml, then cms/_config/050-routes.yml, then the other sapphire/_config fragments.
Part of the work we're looking to do for SilverStripe 3 is to add a static configuration layer. This will become the preferred configuration system, although _config.php will remain both to support legacy code & because some configuration needs to be set dynamically.
Just looking through the _config file I have open now I can quite a few things such as class_exists() calls which would have to stay dynamic? unless we have some layer in the YAML parser to handle this?Part of the work we're looking to do for SilverStripe 3 is to add a static configuration layer. This will become the preferred configuration system, although _config.php will remain both to support legacy code & because some configuration needs to be set dynamically.
I don't like the look of numbers attached to configuration files. Could a better way perhaps be to select configuration from sapphire, then modules, then project code. Modules could be included by a rough calculation from the module manager dependancies (subsites extends cms for instance)- Each fragment should start with a number, and each fragment will be included from lowest to highest, regardless of the module it's in. So it the demo, sapphire/_config/001-routes.yml is first, then sapphire/_config/010-routes.yml, then cms/_config/050-routes.yml, then the other sapphire/_config fragments.
>> - Each fragment should start with a number, and each fragment will be included from lowest to highest, regardless of the module it's in. So it the demo, sapphire/_config/001-routes.yml is first, then sapphire/_config/010-routes.yml, then cms/_config/050-routes.yml, then the other sapphire/_config fragments.
>
> I don't like the look of numbers attached to configuration files. Could a better way perhaps be to select configuration from sapphire, then modules, then project code. Modules could be included by a rough calculation from the module manager dependancies (subsites extends cms for instance)
It's nice to have fragments as an option, but it seems like the kind of thing that we should only have to use if we need to. Ideally for simple sites we can just have mysite/_config/mysite.yml or something.
>
>> Part of the work we're looking to do for SilverStripe 3 is to add a static configuration layer. This will become the preferred configuration system, although _config.php will remain both to support legacy code & because some configuration needs to be set dynamically.
>
> Just looking through the _config file I have open now I can quite a few things such as class_exists() calls which would have to stay dynamic? unless we have some layer in the YAML parser to handle this?
We're not going to rewrite PHP in YAML.
We'll need to enumerate the situations where the configuration is set to one of a number of things based on options, and provide support for those.
I'm guessing that your class_exists() thing is having configuration that varies depending on whether or not a module is installed, or when a specific version of that module is installed.
Some of the optional configs that I can see us needing to support:
- a class existing
- a module being installed
- environment type being dev, test, or live
- an environment flag being set
After writing this, Hamish had a nice solution where modules have updated report config which is cool.
Do we want to remove the _ from _config? Is there a good reason to have it?
Do the numbers have to be at the beginning? It seems like the priorities have more do to with resolving priorities between modules than within on, which means that sorting the contents of subsites/_config/ by priority is of limited use.
Do we want to spell out some priority categories so that people know which numbers to pick as a starting point? That'll help avoid the z-index arms-
race that you get in CSS sometimes. ;-)
For example:
- 100: sapphire
- 200: core modules without dependencies on anything else beyond sapphire - e.g, cms
- 300: basic configuration by core cms modules that don't refer to others; manipulations of cms and/or sapphire configuration
- 500: changes by one module of the behaviour of another module.
- 700: changes from customised versions of modules that are designed for a small number of projects. for example, if a company has its own suite of modules their configuration manipulation would be at this level.
- 900: project-specific changes.
> I like the idea of using the module dependancies, but they don't exist at the moment and may or may not make it into SS3.
That's prudent, but let's leave the door open for it.
It's nice to have fragments as an option, but it seems like the kind of thing that we should only have to use if we need to. Ideally for simple sites we can just have mysite/_config/mysite.yml or something.
Some of the optional configs that I can see us needing to support:
- a class existing
- a module being installed
- environment type being dev, test, or live
Do we want to remove the _ from _config? Is there a good reason to have it?
Do the numbers have to be at the beginning? It seems like the priorities have more do to with resolving priorities between modules than within on, which means that sorting the contents of subsites/_config/ by priority is of limited use.
Do we want to spell out some priority categories so that people know which numbers to pick as a starting point? That'll help avoid the z-index arms-race that you get in CSS sometimes. ;-)
This raises a point: to we want to bring the _ss_environment.php configuration into this brave new world? Right now it's out-of-the-box behaviour is *nothing* except for DEFINing stuff. I think we can improve on this.
The above configuration would then be a config file with a lower priority than the environment file.
Going on from my previous email, I'd suggest that environments are set as priority 800 (lower than the project, but higher than everything else)
One other thing: when setting up a site in cloud-host phpfog, I put my ss_environment configuration into php.ini, which worked well. I'd suggest that we cater for this somehow if we can.
It's nice to have fragments as an option, but it seems like the kind of thing that we should only have to use if we need to. Ideally for simple sites we can just have mysite/_config/mysite.yml or something.
I'm guessing that your class_exists() thing is having configuration that varies depending on whether or not a module is installed, or when a specific version of that module is installed.
The format of the config fragments is mostly YAML, but with a few extensions:- Values can start with a = (see mysite/_config/200-couchdb.yml) to specify PHP values, or =& (see mysite/_config/500-project.yml) to specify references to other config values- Ordered lists normally add more items to any existing items in the list. Values can start with a ! to mean "remove this item from the list if it exists" (see subsites/_config/101-reports.yml). Potentially there'd be a syntax to say where in the list to add items (see cms/_config/100-cms-editor-config.yml).
# YAML Extensions: ArrayI think we should only extend YAML with custom syntax where the language doesn't provide a solution already. YAML already has associative arrays and lists.Its going to be confusing if we allow *some* PHP like array(...) - assuming we don't eval() everything behind an equals sign, right?Particularly as we use custom symbols elsewhere that have slightly different meaning in PHP (ampersand for reference, exclamation mark for negation).
# YAML Extensions: ConstructorsPasswordEncryptor_LegacyPHPHash("md5") - Would this string be passed to Object::create()? I guess it'd be dependent on the class consuming the configuration setting to interpret this as a constructor?
# YAML Extensions: List manipulations
YAML allows list merging and replacement already, although it needs defined anchors (with ampersand) and ugly.I think Hamish's format is superior, but it has the potential to break YAML parsers and formatting in IDEs.So we're assuming to significantly extend an existing YAML parser?
# YAML Extensions: Constant checksI'd prefer Sam's approach of replacing _ss_env (and its PHP defines) with a lower priority YAML configthat would live outside of the webroot in order to configure multiple sites at once. In terms of legacy support,we'd probably need to duplicate this information for a while in both formats.
The || syntax could still be useful though.
# PHP ExecutionSymfony allows PHP execution through <?php ?> tags, see http://www.symfony-project.org/reference/1_4/en/02-YAML#chapter_02_dynamic_yaml_files
# PriorityI'd prefer a "priority: " toplevel key in YAML files rather than ugly file names -mainly because I like to get the big picture of configuration settings without opening a dozen files.
# PriorityI'd prefer a "priority: " toplevel key in YAML files rather than ugly file names -mainly because I like to get the big picture of configuration settings without opening a dozen files.I see it the other way - priority in file names lets you see the order without having to open every file up by just doing a "ls */_config/*.yml"