title: How to use the global.php/local.php configs in the getConfig() of a module in a Zend Framework 2 application?
body: <p>In a ZF2 application I have some cofigs, that: 1. need to be different dependening on the environment; 2. are specific for a concrete module. I'm curently using it like <a href="https://stackoverflow.com/a/15825220/2019043">here</a> described:</p>
  
  <p><strong>global.php &amp; local.php</strong></p>
  
  <pre><code>return array(
      ...
      'modules' =&gt; array(
          'Cache' =&gt; array(
              'ttl' =&gt; 1, // 1 second
          )
      )
      ...
  );
  </code></pre>
  
  <p><strong>Module class</strong></p>
  
  <pre><code>Module {
      ...
      public function getServiceConfig() {
          try {
              return array (
                  'factories' =&gt; array(
                      'Zend\Cache\Adapter\MemcachedOptions' =&gt; function ($serviceManager) {
                          return new MemcachedOptions(array(
                              'ttl'           =&gt; $this-&gt;getConfig()['modules']['Cache']['ttl'],
                              ...
                          ));
                      },
                      ...
                  )
              );
          }
          ...
      }
      ...
  }
  </code></pre>
  
  <p>It's working fine, but I believe, that the module specific settings should be accessed over one central place in the module -- the <code>getConfig()</code> method of the <code>Module</code> class. Like this:</p>
  
  <pre><code>class Module {
  
      public function getConfig() {
          $moduleConfig = include __DIR__ . '/config/module.config.php';
          $application = $this-&gt;getApplicationSomehow(); // &lt;-- how?
          $applicationModuleConfig = $application-&gt;getConfig()['modules'][__NAMESPACE__];
          $config = array_merge($moduleConfig, $applicationModuleConfig);
          return $config;
      }
      ...
      public function getServiceConfig() {
          try {
              return array (
                  'factories' =&gt; array(
                      'Zend\Cache\Adapter\MemcachedOptions' =&gt; function ($serviceManager) {
                          return new MemcachedOptions(array(
                              'ttl'            =&gt; $serviceManager-&gt;get('Config')['modules']['Cache']['ttl'],
                              ...
                          ));
                      },
                      ...
                  )
              );
          }
          ...
      }
      ...
  }
  </code></pre>
  
  <p>The problem is, that I don't get, how to access the global.php/local.php configs in the <code>getConfig()</code> of a module. How can I do it?</p>