title: Multiple configuration files per machine using Laravel
body: <p>I'm using Laravel framework and I'm trying to work with multiple configuration files per machine. 
  Depending on the used URL, I will work with one or another config file. Therefore, I can not use the <a href="http://laravel.com/docs/configuration#environment-configuration" rel="nofollow">Environment Configuration</a> files suggested by Laravel docs.</p>
  
  <p>Right now I'm using JSON config files and everything was working well until I had to deal with the Database.</p>
  
  <p>I'm using <a href="https://github.com/jfelder/Laravel-OracleDB" rel="nofollow">Laravel OracleDB plugin</a> which works pretty well when the DB config (placed in its <code>database.php</code> file) is set statically.</p>
  
  <p>When I try to set the parameters used for the database dynamically, things don't work anymore.</p>
  
  <p>I'm using the <code>Config::set</code> function to change those values like so:</p>
  
  <pre><code>//BaseController.php
  public function __construct(){
      //reading the JSON config file and getting it in a PHP array
      $config= $this-&gt;getConfigFile();
  
      Config::set('oracledb::database.connections.oracle.database', $config['database']);
      Config::set('oracledb::database.connections.oracle.username', $config['username']);
      Config::set('oracledb::database.connections.oracle.password', $config['password']);
  }
  </code></pre>
  
  <p>Like this, the configuration for the database should be set before any Controller tries to do anything with the Database.</p>
  
  <p>To my surprise, even the variables are set in the database configuration (as I can check by using <code>Config::get</code>), Laravel throws an error as it tries to read the default config file from the plugin instead of the new configuration just being set.</p>
  
  <blockquote>
    <p>PDOException
    SQLSTATE[42S02]: pdo_oci_handle_factory: ORA-12154: TNS:could not resolve the connect identifier specified (ext\pdo_oci\oci_driver.c:635)</p>
  </blockquote>
  
  <p>What's going on here? Why the <code>Config::set</code> seems to work but the models seem to get the database connection parameters from the default database.php file instead of using the values I just set?</p>