I have dev and prod environments.

I use payment getaway. There are different api keys for dev and prod envs, it's like test and live mode of the payment method.

There is active dev config split configuration which contains some config with test api keys (CONDITIONAL SPLIT).

So it means, there is also original config witch contains live api keys.

Is it possible to get programmatically both values (original and dev) for some specific configuration?

  • I'd say not without separately reading/parsing your exported configuration files, if you use config split to import/export the different values on the respective environment. Once imported, Drupal has knowledge about the currently imported configuration only. My advice: That you can import/export these keys means they are config values. You can override configuration values per environment in your settings files (e.g. settings.local.php). Such overrides CAN be recognized programmatically, as the original value is database stored. Commented Aug 22, 2018 at 15:32

1 Answer 1


This is a follow-up to my comment on your question with some references:

When using Configuration Split to distinctively use a certain conditional configuration on your environments, then you won't be able to access both, your development and production values at the same time (without reading in these splitted configurations manually).

The reason is, that configuration split hooks into the import/export process of your configuration. Once you import your configuration, the values for the respective environment will replace your database-stored configuration.

If you need to access both values within the same environment, you should change from config split to configuration overrides.

By keeping the production API value database stored across all your environments (in your configuration files that apply to all environments) and having your test API value defined as override within your e.g. settings.local.php file, you'd be able to access both values using Config::get and Config::getOriginal within your dev/staging environments, while only the database stored value will be available in your production site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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