Problem/Motivation

I want to use ENV variables to store API Keys to avoid putting those to the git repo.

Steps to reproduce

Use settings.php to override API Keys, like such:

// Set Typesense keys from env vars if available.
$typesense_read_key = getenv('TYPESENSE_READ_KEY');
$typesense_api_key = getenv('TYPESENSE_API_KEY');
if ($typesense_read_key) {
  $config['search_api.server.typesense_server']['backend_config']['ro_api_key'] = $typesense_read_key;
}
if ($typesense_api_key) {
  $config['search_api.server.typesense_server']['backend_config']['rw_api_key'] = $typesense_api_key;
}

This can be verified to work by doing `drush cget search_api.server.typesense_server --include-overridden`

But this module is using the non-overriden version of API keys in some places. I'm unable to deploy this server from configuration to staging environment because it is telling me that API key is missing.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mikran created an issue. See original summary.

mikran’s picture

Status: Active » Needs review
bedlam’s picture

Thanks for this @mikran.

I swear I'll stop ****ing around with the project's default branch, but can I ask you to recreate this against the 1.0.x branch?

The fix is the right one, and should be incorporated while other api-key issue gets sorted out.

mikran’s picture

Version: 01.0-alpha1 » 1.0.x-dev

  • bedlam committed f7f2dfa on 1.0.x authored by mikran
    Issue #3222283 by mikran: Module is not using overridden ro_api_key /...
bedlam’s picture

Status: Needs review » Fixed

Thanks again @mikran, these changes have been super helpful. Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.