Start, stop, and inspect OTP applications from Cure.

Each Cure app container compiles to a loaded BEAM module that implements the :application behaviour. The functions below delegate to Cure.App.Builtins, which in turn wraps the Erlang :application BIFs, so Cure code sees plain atoms and values rather than OTP's tagged-tuple return shapes.

Examples

use Std.App

ensure_all_started(:cure)
put_env(:my_app, :port, 4000)
get_env(:my_app, :port, 8080)           # => 4000

Functions

  • # fn __group__() -> Atom

    Group tag consumed by Cure.Stdlib.Preload.

  • # fn ensure_all_started(name: Atom) -> Atom extern

    Ensure the application and all of its dependencies are started. Returns :ok whether or not the application was already running.

  • # fn get_env(name: Atom, key: Atom) -> Any extern

    Fetch an environment variable. Returns nil when unset.

  • # fn get_env(name: Atom, key: Atom, default: Any) -> Any extern

    Fetch an environment variable, falling back to default when unset.

  • # fn loaded_applications() -> List(Atom) extern

    Return a list of every loaded application's name atom.

  • # fn put_env(name: Atom, key: Atom, value: Any) -> Atom extern

    Set an environment variable for an application.

  • # fn start(name: Atom) -> Atom extern

    Start a loaded application by name. Idempotent.

  • # fn start_phase(name: Atom, phase: Atom, phase_args: Any) -> Atom extern

    Manually invoke a start-phase callback for an application. Normally the OTP boot script drives this; exposed here for tests and scripted scenarios.

  • # fn stop(name: Atom) -> Atom extern

    Stop a running application by name. Idempotent.

  • # fn which_applications() -> List(Tuple) extern

    Return a list of %[name, description, vsn] tuples for every currently-running application.