libero/config

Types

Everything libero needs from its invocation args, normalized. Paths are derived from –namespace and –client with single-SPA defaults when those flags are absent.

pub type Config {
  Config(
    ws_mode: WsMode,
    namespace: option.Option(String),
    client_root: String,
    atoms_output: String,
    atoms_module: String,
    config_output: String,
    register_gleam_output: String,
    register_ffi_output: String,
    register_relpath_prefix: String,
    shared_src: option.Option(String),
    server_src: option.Option(String),
    server_generated: String,
    client_generated: String,
  )
}

Constructors

  • Config(
      ws_mode: WsMode,
      namespace: option.Option(String),
      client_root: String,
      atoms_output: String,
      atoms_module: String,
      config_output: String,
      register_gleam_output: String,
      register_ffi_output: String,
      register_relpath_prefix: String,
      shared_src: option.Option(String),
      server_src: option.Option(String),
      server_generated: String,
      client_generated: String,
    )

    Arguments

    atoms_output

    Path to the generated .erl file that pre-registers all constructor atoms for safe ETF decoding.

    atoms_module

    Erlang module name for the atoms .erl file, using Gleam’s path-to-module convention (@ separators).

    register_relpath_prefix

    Bundle-relative prefix that prepends every import in the generated FFI .mjs file. Depth depends on where the register files land inside the consumer client package.

How the generated client resolves its WebSocket URL.

pub type WsMode {
  WsFullUrl(url: String)
  WsPathOnly(path: String)
}

Constructors

  • WsFullUrl(url: String)

    Hardcoded full URL (from –ws-url). Single-host deployments.

  • WsPathOnly(path: String)

    Path-only, resolved at runtime from window.location (from –ws-path). Multi-tenant deployments where multiple subdomains share one bundle.

Values

pub fn build_config(
  ws_mode ws_mode: WsMode,
  namespace namespace: option.Option(String),
  client_root client_root: String,
  shared_root shared_root: Result(String, Nil),
  server_root server_root: Result(String, Nil),
) -> Config

Derive all paths from –namespace and –client. When namespace is None the paths land under generated/libero/ inside the consumer’s server and client packages. When set, paths are nested one level deeper under generated/libero// to keep multi-SPA output physically isolated.

pub fn find_flag(
  args args: List(String),
  name name: String,
) -> Result(String, Nil)

Extract a --name=value flag from the argument list.

pub fn parse_config() -> Config
Search Document