An API key is not reachable when it's overridden in settings.php

Created on 24 November 2022, about 2 years ago
Updated 9 April 2023, almost 2 years ago

Problem/Motivation

Storing the API keys in configs/git is not a recommended way. So often the overriding of configurations are used for this. For example, overriding part of config in settings.php. So the issue exists in DrupalClient class in the construct method. When you determine $this->config class property.

$this->config = $config_factory->getEditable('akismet.settings');

The ConfigFactoryInterface::getEditable() method is used for loading configs that you want to update and it doesn't take into account the overridden values.

https://www.drupal.org/node/2407153

Steps to reproduce

1. Go to the configuration page of the Akismet and fill in all required settings except the API key.
2. Override this value in the settings.php file with $config['akismet.settings']['api_key'] = "[YOUR_API_KEY]";

Proposed resolution

Replace ConfigFactoryInterface::getEditable() method with ConfigFactoryInterface::get() for retrieving actual config values.

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇹🇷Turkey alexander.levitsky Antalya

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024