title: Load Config File Before Library in Code Igniter
body: <p>I am loading the google-api-php-client library (for oauth 2.0 usage) in my codeigniter project. I would like to have a series of configuration values defined in a config file so that they can be used with this library. I am, however, noticing that the configuration info for the library is loaded before the config file that I have defined.</p>
  
  <p>For example, in <code>autoload.php</code>, I have set the config autoloads as follows:</p>
  
  <pre><code>$autoload['config'] = array('my_config_file');
  </code></pre>
  
  <p>Within <code>my_config_file.php</code> I have a series of <code>define</code> statements to set the config values:</p>
  
  <pre><code>define('GOOGLE_OAUTH_APPLICATION_NAME','My Application Name');
  define('GOOGLE_OAUTH_CLIENT_ID','My App Client ID');
  define('GOOGLE_OAUTH_CLIENT_SECRET','My App Client Secret');
  </code></pre>
  
  <p>I would like to use these in the config for the google-api-php-client library:</p>
  
  <pre><code>global $apiConfig;
  $apiConfig = array(
      'application_name' =&gt; GOOGLE_OAUTH_APPLICATION_NAME,
      'oauth2_client_id' =&gt; GOOGLE_OAUTH_CLIENT_ID,
      'oauth2_client_secret' =&gt; GOOGLE_OAUTH_CLIENT_SECRET
  );
  </code></pre>
  
  <p>After doing this (and some debugging), I've determined that the config file for the library is executed before the autoloaded config file. This is further shown by the errors I get:</p>
  
  <pre><code>Notice: Use of undefined constant GOOGLE_OAUTH_APPLICATION_NAME ...
  Notice: Use of undefined constant GOOGLE_OAUTH_CLIENT_ID ...
  Notice: Use of undefined constant GOOGLE_OAUTH_CLIENT_SECRET ...
  </code></pre>
  
  <p>How do I get it so that these global config constants are defined before the library config is loaded (thus resolving this issue)?</p>