Raxol.Core.Config.ConfigServer (Raxol v2.0.1)

View Source

Unified configuration management system for Raxol. Consolidates configuration from multiple specialized config modules:

  • PluginConfig
  • TerminalConfig
  • PerformanceConfig
  • SecurityConfig
  • BenchmarkConfig

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets configuration value from specified namespace and key.

Gets entire namespace configuration.

Loads configuration from file system.

Resets namespace to default configuration.

Saves configuration to file system.

Sets configuration value in specified namespace and key.

Sets entire namespace configuration.

Validates configuration for specified namespace.

Types

config_key()

@type config_key() :: atom() | String.t()

config_namespace()

@type config_namespace() ::
  :terminal | :plugins | :performance | :security | :ui | :benchmark

config_value()

@type config_value() :: any()

t()

@type t() :: %Raxol.Core.Config.ConfigServer{
  benchmark: map(),
  performance: map(),
  persistence: map(),
  plugins: map(),
  security: map(),
  terminal: map(),
  ui: map(),
  version: String.t()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(server \\ __MODULE__, namespace, key, default \\ nil)

@spec get(GenServer.server(), config_namespace(), config_key(), any()) :: any()

Gets configuration value from specified namespace and key.

get_namespace(server \\ __MODULE__, namespace)

@spec get_namespace(GenServer.server(), config_namespace()) :: map()

Gets entire namespace configuration.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

load_from_file(server \\ __MODULE__)

@spec load_from_file(GenServer.server()) :: :ok | {:error, any()}

Loads configuration from file system.

reset_namespace(server \\ __MODULE__, namespace)

@spec reset_namespace(GenServer.server(), config_namespace()) :: :ok

Resets namespace to default configuration.

save_to_file(server \\ __MODULE__)

@spec save_to_file(GenServer.server()) :: :ok | {:error, any()}

Saves configuration to file system.

set(server \\ __MODULE__, namespace, key, value)

@spec set(
  GenServer.server(),
  config_namespace(),
  config_key(),
  config_value()
) :: :ok | {:error, any()}

Sets configuration value in specified namespace and key.

set_namespace(server \\ __MODULE__, namespace, config)

@spec set_namespace(GenServer.server(), config_namespace(), map()) ::
  :ok | {:error, any()}

Sets entire namespace configuration.

start_link(init_opts \\ [])

validate(server \\ __MODULE__, namespace)

@spec validate(GenServer.server(), config_namespace()) :: :ok | {:error, [String.t()]}

Validates configuration for specified namespace.