I have set up the plugin's multi-environment configuration as outlined in this answer.

The config.php file for the plugin is as follows:


return array(
    // All
    '*' => array(

    // Development
    '.domain.dev' => array(
        'apiKey' => 'APIKEYDEVVALUE'

    // Staging
    'dev.domain.com' => array(
        'apiKey' => 'APIKEYSTAGINGVALUE'

    // Production
    'dev.domain.com' => array(
        'apiKey' => 'APIKEYPRODVALUE'

But calling craft()->config->get('apiKey', 'pluginhandle') returns null.

If I var_dump(craft()->config) I can see that the config file for the plugin is loaded by craft.

What am I missing? Please let me know if I can provide any more useful info.

1 Answer 1


The issue is that you're putting the multi-environment config code in your plugins/pluginHandle/config.php file, which is just meant to supply default plugin config values.

Users can set custom values in craft/config/pluginHandle.php which is where the multi-environment logic would also go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.