Method: ConfigurationService::Client#publish_configuration

Defined in:
lib/configuration_service/client.rb

#publish_configuration(identifier: nil, data: nil, metadata: {}) ⇒ ConfigurationService::Configuration

Publishes configuration data and metadata

The metadata is decorated with the following keys:

  • “timestamp” - the current UTC time in ISO8601 format

  • “revision” - a UUID for this publication

Delegates the request to the configured provider. The provider may further decorate the metadata.

It is recommended that both the data and metadata dictionaries use strings as keys, and that values be limited to those that can be serialized to JSON.

Parameters:

  • identifier (String) (defaults to: nil)

    unique identifier of configuration. Required if the instance was initialized with a context that provided no identifier.

  • data (Hash) (defaults to: nil)

    dictionary of probably sensitive configuration data intended for an application, which providers are expected to secure

  • metadata (Hash) (defaults to: {})

    dictionary of data about the configuration data, which providers are not expected to secure

Returns:

Raises:



73
74
75
76
77
78
79
80
81
# File 'lib/configuration_service/client.rb', line 73

def publish_configuration(identifier: nil, data: nil, metadata: {})
  identifier = identifier_argument_or_instance_variable(identifier)
  Utils.dictionary?(data) or raise ConfigurationService::Error, "data must be a dictionary"
  Utils.dictionary?() or raise ConfigurationService::Error, "metadata must be a dictionary"

   = Utils.decorate()
  configuration = Configuration.new(identifier, data, )
  @provider.publish_configuration(configuration, @credentials)
end