Marea.Config (marea v0.0.1-rc.1)

Copy Markdown View Source

Runtime state struct shared by every command.

A Marea.Config.t/0 is produced by make_config/1 during service init and threaded through the Marea.Plugins.Base.marea_cmd/2 plugin chain. It carries the validated marea.yaml, the parsed CLI command/options/flags, the loaded configs/ and secrets/ files, and persisted last values.

Summary

Types

t()

Runtime state struct shared by every command.

Functions

Returns the current Marea.Config.t/0 from the running service.

Builds the initial config used by Marea.Service during init.

Types

t()

@type t() :: %Marea.Config{
  cmd_prefix: %{optional(atom()) => String.t()} | nil,
  cmds: [atom()] | nil,
  configs: %{optional(String.t()) => term()} | nil,
  flags: map() | nil,
  marea_config: map() | nil,
  marea_config_file: String.t() | nil,
  marea_dir: String.t() | nil,
  optimus: Optimus.t() | nil,
  options: map() | nil,
  secrets: %{optional(String.t()) => term()} | nil,
  state_dir: String.t() | nil,
  values: map() | nil
}

Runtime state struct shared by every command.

Fields:

  • :marea_config_file — path the YAML was read from.
  • :marea_config — validated YAML (output of the Zoi schema).
  • :optimus — the Optimus parser used for :usage fallbacks.
  • :cmds — parsed subcommand chain (e.g. [:build, :docker]).
  • :options, :flags — parsed CLI options/flags.
  • :configs — files loaded from <marea_dir>/configs/.
  • :secrets — files loaded from <marea_dir>/secrets/ (YAML decoded).
  • :values — persisted state from .marea/last_values plus command-derived values (e.g. :deploy, :release, :git_vsn).
  • :marea_dir, :state_dir, :cmd_prefix — resolved from YAML.

Functions

get_config()

@spec get_config() :: t()

Returns the current Marea.Config.t/0 from the running service.

make_config(service_config)

@spec make_config(keyword()) :: {:ok, keyword()}

Builds the initial config used by Marea.Service during init.

Runs the Marea.Plugins.Base.marea_deploy_types/1, Marea.Plugins.Base.marea_release_types/1, Marea.Plugins.Base.marea_config_schema/1 and Marea.Plugins.Base.marea_config_args/1 plugin chains, validates the YAML against the resulting schema, parses the CLI args with Optimus, loads configs/ and secrets/, and restores values persisted in .marea/last_values.