CompaniesHouse.Config (CompaniesHouse v0.2.0)

View Source

Methods to parse and modify configurations.

Summary

Functions

Gets the API key from configuration. Raises ConfigError if API key is not configured.

Gets the environment from configuration. Default is :sandbox if not explicitly configured. Raises ConfigError if environment is invalid.

Gets the key value from the environment config.

Puts a new key value to the configuration.

Raise a ConfigError exception.

Types

t()

@type t() :: Keyword.t()

Functions

api_key()

@spec api_key() :: String.t()

Gets the API key from configuration. Raises ConfigError if API key is not configured.

environment()

@spec environment() :: :sandbox | :live

Gets the environment from configuration. Default is :sandbox if not explicitly configured. Raises ConfigError if environment is invalid.

get(key, default \\ nil)

@spec get(atom(), any()) :: any()

Gets the key value from the environment config.

put(config, key, value)

@spec put(t(), atom(), any()) :: t()

Puts a new key value to the configuration.

raise_error(message)

@spec raise_error(binary()) :: no_return()

Raise a ConfigError exception.