ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Boot

Description

The shared boot environment owns the process logger and telemetry resources. Role work ends before these resources drain and close. ecluse check-config (Ecluse.CheckConfig) reuses the configuration prologue and the runtime-knob projection here, so the two entry points cannot disagree about what a start-up reads or refuses.

Synopsis

The boot environment

data BootEnv Source #

Configuration and process resources borrowed by a running role.

Constructors

BootEnv 

Fields

  • beConfig :: Config

    The complete loaded configuration, including its provenance.

  • beLogEnv :: LogEnv

    The process structured-logging environment.

  • beTelemetry :: Telemetry

    The telemetry handle, inert unless ECLUSE_OBSERVABILITY__TELEMETRY enabled it.

  • beBootPlan :: BootPlan

    The resolved plan, whose diagnostics were logged before role work starts.

withBootEnv :: BootRole -> (BootEnv -> IO a) -> IO a Source #

Drain the process logger after role work and telemetry cleanup, on normal or exceptional exit.

The configuration prologue

loadBootConfig :: (Text -> Text) -> IO ([(String, String)], Maybe ByteString, Config) Source #

The environment, the secret files it names, the config document, and the parse, in that order. decorate wraps each refusal, which is how ecluse check-config adds its own verdict line.

applySecretFileIndirection :: [(String, String)] -> IO (Either Text [(String, String)]) Source #

Resolve secret files, strip trailing newlines, and refuse conflicting direct values.

readConfigDocument :: [(String, String)] -> IO (Either Text (Maybe ByteString)) Source #

Accept a missing default document, but refuse an explicit path that does not exist.

runtimeOverridesOf :: RuntimeSettings -> RuntimeOverrides Source #

Project the configured runtime knobs onto the posture the RTS applies.

Refusal

newtype BootAborted Source #

A start-up refusal that the process perimeter reports before exiting.

Constructors

BootAborted Text 

orExit :: (e -> Text) -> Either e a -> IO a Source #

Abort on a rendered refusal, or return the successful result.

refuseBoot :: Text -> IO a Source #

Raise the complete refusal for the process perimeter to report.

Boot-time logging and wiring

logBootWarning :: LogEnv -> Text -> IO () Source #

Report a boot warning under the root module's logging context.

logBootInfo :: LogEnv -> Text -> IO () Source #

Report a boot diagnostic under the root module's logging context.

logRuleBootOrder :: LogEnv -> [MountBinding] -> IO () Source #

Report evaluation order for each wired mount.

buildMirrorQueue :: LogEnv -> Int -> MirrorQueuePlan -> IO MirrorQueue Source #

Build the planned queue and log its durability and delivery-limit warnings.

applyServerSettings :: ServerSettings -> ServerConfig -> ServerConfig Source #

Apply the shared listener settings without replacing role hooks or the launch's drain signal.

probeServerConfig :: AppConfig -> ServerConfig Source #

Serve health probes with the shared listener settings and no package mounts.