I am trying to put my API keys in a separate file instead of storing them in config management.

For example, I installed the Commerce Stripe module.

When I export the config, it looks like this:


uuid: 430a9544-c852-4a14-b7b0-3a833a02dd06
langcode: en
status: true
    - commerce_stripe
id: stripe_test
label: 'Stripe Test'
weight: null
plugin: stripe
  publishable_key: thisishidden
  secret_key: thisishidden
  display_label: Stripe
  mode: test
    - credit_card
conditions: {  }
conditionOperator: AND

Now, I want to store publishable_key and secret_key in a file, but how do I determine the "path" to call them?

$config['whatgoeshere?']['configuration']['secret_key'] = 'abcdefg';

1 Answer 1


The first key is the name of the config object/file, so... commerce_payment.comerce_payment_gateway.stripe_test.

The rest you already figured out, it's an array that's recursively merged into the other one.

  • 1
    Actually its more like $config['system.performance']['js']['preprocess'] = FALSE; ... just to be clear about the structure. So the root(fist key) is the config name(yml file name) and the rest is structure as set in the config(yml) file itself.
    – user21641
    Sep 21, 2017 at 13:47
  • 1
    true, I was answering specifically to the "whatgoeshere?" part in the question, there already is example with just that part missing
    – Berdir
    Sep 21, 2017 at 15:19
  • This is not available in any documentation anywhere that I was able to find! (With regards to how to reference the nested yaml items)
    – NikLP
    May 20, 2019 at 13:57
  • @NikLP there are several examples in settings.php, as a start.
    – Berdir
    May 27, 2019 at 9:17
  • You're correct (naturally). I had not been able to see this clearly enough to formulate a correlation between the nested yamls and the array syntax. We might do well to add a small entry in the docs on config overrides outlining this specific syntax.
    – NikLP
    May 28, 2019 at 10:47

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.