Configuration
Configuration is saved in the file Configuration.xml. This file can be located either in the config/ or src/ subdirectories. By setting the environment variable NOSTROMO_CONFIG it can be placed in any other path as well.
The configuration file has a general section and mutiple specific configuration sections that are bound to URL patterns. If a setting is the same for all environments then it can be placed in the general section. If a setting is present in both sections then the more specific one is used. The specific sections are chosen based on the URL the site was called with.
If the call happens via CLI (like in Unit-Tests) the configuration section is chosen that has a test tag that is set to true.
Example:
<application>
<general>
<category>
<value>foo</value>
</category>
</general>
<configuration name="dev">
<urlPattern>localhost/demo</urlPattern>
<category>
<value>bar</value>
</category>
</configuration>
<configuration name="test">
<test>true</test>
<urlPattern>testserver.com</urlPattern>
</configuation>
</application>
Consider the following code:
echo Configuration::get('category.value');
// Called using http://localhost/demo/
"bar"
// Valled using http://www.testserver.com/myapp
"foo"
Â