2

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:

commerce_payment.comerce_payment_gateway.stripe_test.yml

uuid: 430a9544-c852-4a14-b7b0-3a833a02dd06
langcode: en
status: true
dependencies:
  module:
    - commerce_stripe
id: stripe_test
label: 'Stripe Test'
weight: null
plugin: stripe
configuration:
  publishable_key: thisishidden
  secret_key: thisishidden
  display_label: Stripe
  mode: test
  payment_method_types:
    - 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

3

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.

5
  • 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
    Commented 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
    Commented 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
    Commented May 20, 2019 at 13:57
  • @NikLP there are several examples in settings.php, as a start.
    – Berdir
    Commented 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
    Commented 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.