Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Überblick

Die Konfiguration wird in der Datei Configuration is saved in the file Configuration.xml im src/ Ordner abgelegt. Im Bereich <general></general> kann man globale Einstellungen hinterlegen. In den jeweiligen Konfigurationen für ein bestimmtes Environment kann man diese jederzeit überschreiben. 

Auswahl der verwendeten Konfiguration

Die zu verwendende Konfiguration wird auf Basis der aufgerufenen URL ermittelt. Bei Unit-Tests wird diejenige Konfiguration verwendet, die mit dem Tag <test>true</test> ausgezeichnet ist.. 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:

Code Block
languagexml
<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:

Code Block
languagephp
echo Configuration::get('category.value');

// Called using http://localhost/demo/
"bar"

// Valled using http://www.testserver.com/myapp
"foo"