Util (secret_config v1.0.0)

Utility functions for processing configuration data, including parsing YAML strings, applying local imports, and handling AWS SSM parameters.

Link to this section Summary

Functions

Applies imports from SSM parameters into the initial configuration map.

Applies local import rules to a configuration map, handling special keys for import directives.

Constructs a full key by combining the environment prefix and the specific key.

Recursively constructs a map from YAML data, transforming nested structures into a flattened path map.

Converts a YAML string into a nested map, applying EEx evaluation with bindings from the application configuration.

Link to this section Functions

Link to this function

apply_imports(init_map, app_prefix)

Specs

apply_imports(map(), String.t()) :: map()

Applies imports from SSM parameters into the initial configuration map.

Parameters

  • init_map: The initial configuration map before imports.
  • app_prefix: A prefix used to scope the SSM parameter imports.

Returns

  • A configuration map with SSM imports applied.
Link to this function

apply_local_imports(map)

Specs

apply_local_imports(map()) :: map()

Applies local import rules to a configuration map, handling special keys for import directives.

Parameters

  • map: The initial configuration map.

Returns

  • A modified map with local imports applied.
Link to this function

full_key(env, key)

Specs

full_key(String.t(), String.t()) :: String.t()

Constructs a full key by combining the environment prefix and the specific key.

Parameters

  • env: The environment name or prefix.
  • key: The specific configuration key.

Returns

  • A string representing the full key path.
Link to this function

pathize_map(yaml_map, prefix, path_map)

Specs

pathize_map(map(), String.t(), map()) :: map()

Recursively constructs a map from YAML data, transforming nested structures into a flattened path map.

Parameters

  • yaml_map: The nested map obtained from YAML parsing.
  • prefix: The current path prefix, used for recursion.
  • path_map: The accumulator for the flattened path map.

Returns

  • A flattened path map representing the YAML structure.
Link to this function

ssm_parameter_map(map, next_token, first_run, path)

Specs

ssm_parameter_map(map(), nil | String.t(), boolean(), String.t()) :: map()
Link to this function

yaml_str_to_map(yaml_str)

Specs

yaml_str_to_map(String.t()) :: map()

Converts a YAML string into a nested map, applying EEx evaluation with bindings from the application configuration.

Parameters

  • yaml_str: The YAML string to be converted.

Returns

  • A map representing the YAML structure with paths as keys.