Module: ConfigurationService::Provider::Vault::PathHelper

Defined in:
lib/configuration_service/provider/vault/path_helper.rb

Overview

Utility module for creating Vault paths

The module supports:

  • versioning paths to support backward-incompatible changes to the pathing and data schemes;

  • composing the configuration identifier into the path, and

  • composing a revision (or “latest”) into the path, to support revision history.

Constant Summary collapse

PREFIX =
"secret/config/v1"

Class Method Summary collapse

Class Method Details

.path(identifier, revision = "latest") ⇒ String

Revision path

Parameters:

  • identifier (String)

    the unique identity of the configuration

  • revision (String) (defaults to: "latest")

    the unique metadata revision of the configuration

Returns:

  • (String)

    the Vault path for the revision of identifier



32
33
34
# File 'lib/configuration_service/provider/vault/path_helper.rb', line 32

def self.path(identifier, revision = "latest")
  "#{policy_path(identifier)}/#{revision}"
end

.policy_path(identifier) ⇒ String

Policy path

Since policies must apply to all revisions of the identified configuration, the policy path is necessarily broad.

Parameters:

  • identifier (String)

    the unique identity of the configuration

Returns:

  • (String)

    the Vault path for all revisions for identifier



47
48
49
# File 'lib/configuration_service/provider/vault/path_helper.rb', line 47

def self.policy_path(identifier)
  "#{PREFIX}/#{identifier}"
end