2

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:

<?php

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.

acarbonaro
  • 45
  • 5

1 Answers1

4

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.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143