Raxol.Application (Raxol v2.0.1)

View Source

Main application module for Raxol terminal emulator.

Handles application startup, supervision tree initialization, core system configuration, and runtime feature management.

Environment-based Configuration

The application adapts its behavior based on the environment:

  • :test - Minimal supervision tree for testing
  • :minimal - Ultra-fast startup with core features only
  • :dev - Full feature set with development tools
  • :prod - Production configuration with optimizations

Feature Flags

Features can be enabled/disabled via configuration:

config :raxol, :features,
  web_interface: true,
  terminal_driver: true,
  plugins: false,
  telemetry: true

Health Monitoring

The application includes built-in health checks:

  • Supervision tree health
  • Memory usage monitoring
  • Process count tracking
  • Telemetry event monitoring

Summary

Functions

Dynamically add a child to the supervision tree.

Get current application health status.

Dynamically remove a child from the supervision tree.

Toggle a feature flag at runtime. Some features require application restart to take effect.

Types

child_spec()

@type child_spec() :: Supervisor.child_spec() | {module(), term()} | module()

feature_flag()

@type feature_flag() :: atom()

start_mode()

@type start_mode() :: :full | :minimal | :custom

Functions

add_child(child_spec)

@spec add_child(child_spec()) :: {:ok, pid()} | {:error, term()}

Dynamically add a child to the supervision tree.

handle_info(atom, state)

health_status()

@spec health_status() :: %{
  mode: atom(),
  supervisor_alive: boolean(),
  children: non_neg_integer(),
  memory_mb: non_neg_integer(),
  process_count: non_neg_integer(),
  features: map(),
  uptime_seconds: integer()
}

Get current application health status.

remove_child(child_id)

@spec remove_child(pid() | atom()) ::
  :ok | {:error, :dynamic_supervisor_not_started | :not_found}

Dynamically remove a child from the supervision tree.

toggle_feature(feature, enabled)

@spec toggle_feature(feature_flag(), boolean()) :: :ok | {:error, :restart_required}

Toggle a feature flag at runtime. Some features require application restart to take effect.