You are here

public function EnvironmentVariablesKeyProvider::realGetKeyValue in Apigee Edge 8

The method that returns a key's value after pre-requirements got validated.

Parameters

\Drupal\key\KeyInterface $key: A key entity.

Overrides KeyProviderRequirementsBase::realGetKeyValue

File

src/Plugin/KeyProvider/EnvironmentVariablesKeyProvider.php, line 65

Class

EnvironmentVariablesKeyProvider
Stores Apigee Edge authentication credentials in environment variables.

Namespace

Drupal\apigee_edge\Plugin\KeyProvider

Code

public function realGetKeyValue(KeyInterface $key) {
  $key_value = [];
  foreach ($this
    ->getEnvironmentVariables($key) as $id => $variable) {
    if (getenv($variable)) {
      $key_value[$id] = getenv($variable);
    }
  }
  return Json::encode((object) $key_value);
}