| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Config
Synopsis
- data Config = Config {}
- data AppConfig = AppConfig {
- cfgServer :: ServerSettings
- cfgQueue :: QueueSettings
- cfgLimits :: LimitsSettings
- cfgCache :: CacheSettings
- cfgIntegrity :: IntegritySettings
- cfgEgress :: EgressSettings
- cfgAdvisories :: AdvisoriesSettings
- cfgRuntime :: RuntimeSettings
- cfgObservability :: ObservabilitySettings
- cfgMounts :: Map Ecosystem MountConfig
- data ServerSettings = ServerSettings {
- srvPort :: Int
- srvPublicUrl :: Maybe Url
- srvAuthToken :: Maybe Secret
- srvHelpMessage :: Maybe Text
- srvShutdownDrainTimeout :: Int
- data QueueSettings = QueueSettings {}
- data LimitsSettings = LimitsSettings {}
- data CacheSettings = CacheSettings {}
- data IntegritySettings = IntegritySettings {
- intMinPublic :: MinIntegrity
- intMinTrusted :: MinTrustedIntegrity
- intDivergencePolicy :: DivergencePolicy
- newtype EgressSettings = EgressSettings {}
- data AdvisoriesSettings = AdvisoriesSettings {}
- data RuntimeSettings = RuntimeSettings {}
- data ObservabilitySettings = ObservabilitySettings {
- obsLogFormat :: LogFormat
- obsTelemetry :: TelemetrySwitch
- type MountMap = Map Ecosystem Mount
- data Mount = Mount {
- mountEcosystem :: Ecosystem
- mountRegistries :: MountRegistries
- mountPolicy :: [PrecededRule]
- data MountRegistries = MountRegistries {
- regPublicUpstream :: RegistryUrl
- regMode :: MountMode
- data MountMode
- = Mirrored MirroredLegs
- | ServeOnly (Maybe RegistryUrl)
- data MirroredLegs = MirroredLegs {
- mlPrivateUpstream :: RegistryUrl
- mlMirrorTarget :: MirrorTarget
- regPrivateUpstream :: MountRegistries -> Maybe RegistryUrl
- regMirrorTarget :: MountRegistries -> Maybe MirrorTarget
- data MirrorTarget = MirrorTarget {
- mtUrl :: RegistryUrl
- mtCredential :: MirrorCredential
- data MirrorCredential
- = MirrorCodeArtifact CodeArtifactConfig
- | MirrorStatic Secret
- data MountConfig = MountConfig {
- mntEnabled :: Maybe Bool
- mntPrivateUpstream :: Maybe RegistryUrl
- mntPublicUpstream :: RegistryUrl
- mntMirrorTarget :: Maybe RegistryUrl
- mntMirrorTargetToken :: Maybe Secret
- mntMirrorCodeArtifactTokenDuration :: Maybe Natural
- mntPublicationTarget :: Maybe RegistryUrl
- mntPublicationTargetToken :: Maybe Secret
- mntPublishAllow :: [Scope]
- mntMinTrustedIntegrity :: Maybe MinTrustedIntegrity
- mntDivergencePolicy :: Maybe DivergencePolicy
- mntAdditionalRules :: RulePatch
- newtype Url = Url Text
- mkUrl :: Text -> Either Text Url
- unUrl :: Url -> Text
- newtype RulePatch = RulePatch (Map Text RuleEntry)
- data RuleEntry = RuleEntry {}
- newtype RulePolicy = RulePolicy {
- policyRules :: Map Text PrecededRule
- data PolicyError
- renderPolicyError :: PolicyError -> Text
- emptyPolicy :: RulePolicy
- defaultPolicy :: RulePolicy
- data ConfigError
- = ParseError Text
- | PolicyErrors [PolicyError]
- | PublicUrlRequired
- | MountMissingPrivateUpstream Ecosystem
- | MirrorSettingWithoutWrite Ecosystem Text
- | MirrorCredentialTokenMissing Ecosystem
- | MirrorCredentialConflict Ecosystem
- renderConfigError :: ConfigError -> Text
- loadConfig :: [(String, String)] -> Maybe ByteString -> Either [ConfigError] Config
- mountCollisionWarnings :: Config -> [Text]
- mountPostureLines :: Config -> [Text]
- resolvedKeyProvenance :: [(String, String)] -> Maybe ByteString -> [Text]
Documentation
Constructors
| Config | |
Fields | |
The resolved application configuration, one sub-record per document group so a field's home says what it governs (the document schema and this type mirror each other one to one).
Constructors
| AppConfig | |
Fields
| |
data ServerSettings Source #
The server group: the inbound edge Écluse itself presents.
Constructors
| ServerSettings | |
Fields
| |
Instances
| Show ServerSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> ServerSettings -> ShowS # show :: ServerSettings -> String # showList :: [ServerSettings] -> ShowS # | |
| Eq ServerSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: ServerSettings -> ServerSettings -> Bool # (/=) :: ServerSettings -> ServerSettings -> Bool # | |
data QueueSettings Source #
The queue group: the mirror queue's destination and the in-memory rollover's
depth cap. The backend is derived from the URL's shape (Ecluse.Config.QueueTarget),
never named here.
Constructors
| QueueSettings | |
Instances
| Show QueueSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> QueueSettings -> ShowS # show :: QueueSettings -> String # showList :: [QueueSettings] -> ShowS # | |
| Eq QueueSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: QueueSettings -> QueueSettings -> Bool # (/=) :: QueueSettings -> QueueSettings -> Bool # | |
data LimitsSettings Source #
The limits group: the hostile-input bounds. The structural counts are pinned
policy defaults; the byte-valued caps are computed from the memory plan when
unset (Ecluse.Composition.MemoryPlan), a configured value always winning.
Constructors
| LimitsSettings | |
Fields
| |
Instances
| Show LimitsSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> LimitsSettings -> ShowS # show :: LimitsSettings -> String # showList :: [LimitsSettings] -> ShowS # | |
| Eq LimitsSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: LimitsSettings -> LimitsSettings -> Bool # (/=) :: LimitsSettings -> LimitsSettings -> Bool # | |
data CacheSettings Source #
The cache group: the metadata cache's TTL and its computed-by-default bounds.
Constructors
| CacheSettings | |
Fields
| |
Instances
| Show CacheSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> CacheSettings -> ShowS # show :: CacheSettings -> String # showList :: [CacheSettings] -> ShowS # | |
| Eq CacheSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: CacheSettings -> CacheSettings -> Bool # (/=) :: CacheSettings -> CacheSettings -> Bool # | |
data IntegritySettings Source #
The integrity group: the global integrity floors and divergence policy
(minTrusted and divergencePolicy refinable per mount).
Constructors
| IntegritySettings | |
Fields
| |
Instances
| Show IntegritySettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> IntegritySettings -> ShowS # show :: IntegritySettings -> String # showList :: [IntegritySettings] -> ShowS # | |
| Eq IntegritySettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: IntegritySettings -> IntegritySettings -> Bool # (/=) :: IntegritySettings -> IntegritySettings -> Bool # | |
newtype EgressSettings Source #
The egress group: the operator's additions to the blocked target ranges.
Constructors
| EgressSettings | |
Fields | |
Instances
| Show EgressSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> EgressSettings -> ShowS # show :: EgressSettings -> String # showList :: [EgressSettings] -> ShowS # | |
| Eq EgressSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: EgressSettings -> EgressSettings -> Bool # (/=) :: EgressSettings -> EgressSettings -> Bool # | |
data AdvisoriesSettings Source #
The advisories group: the OSV/CVE pipeline's bucket, cadences, and bounds.
Constructors
| AdvisoriesSettings | |
Fields | |
Instances
| Show AdvisoriesSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> AdvisoriesSettings -> ShowS # show :: AdvisoriesSettings -> String # showList :: [AdvisoriesSettings] -> ShowS # | |
| Eq AdvisoriesSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: AdvisoriesSettings -> AdvisoriesSettings -> Bool # (/=) :: AdvisoriesSettings -> AdvisoriesSettings -> Bool # | |
data RuntimeSettings Source #
The runtime group: the process-sizing overrides. Every field is optional;
unset, each is computed from the runtime posture (cgroups, RTS, file-descriptor
limit) with its provenance boot-logged.
Constructors
| RuntimeSettings | |
Fields | |
Instances
| Show RuntimeSettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> RuntimeSettings -> ShowS # show :: RuntimeSettings -> String # showList :: [RuntimeSettings] -> ShowS # | |
| Eq RuntimeSettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: RuntimeSettings -> RuntimeSettings -> Bool # (/=) :: RuntimeSettings -> RuntimeSettings -> Bool # | |
data ObservabilitySettings Source #
The observability group: log shape and telemetry switch.
Constructors
| ObservabilitySettings | |
Fields
| |
Instances
| Show ObservabilitySettings Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> ObservabilitySettings -> ShowS # show :: ObservabilitySettings -> String # showList :: [ObservabilitySettings] -> ShowS # | |
| Eq ObservabilitySettings Source # | |
Defined in Ecluse.Config.Types Methods (==) :: ObservabilitySettings -> ObservabilitySettings -> Bool # (/=) :: ObservabilitySettings -> ObservabilitySettings -> Bool # | |
Constructors
| Mount | |
Fields
| |
data MountRegistries Source #
Constructors
| MountRegistries | |
Fields
| |
Instances
| Show MountRegistries Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> MountRegistries -> ShowS # show :: MountRegistries -> String # showList :: [MountRegistries] -> ShowS # | |
| Eq MountRegistries Source # | |
Defined in Ecluse.Config.Types Methods (==) :: MountRegistries -> MountRegistries -> Bool # (/=) :: MountRegistries -> MountRegistries -> Bool # | |
Whether a mount mirrors, derived from its declared endpoints: a declared
mirrorTarget makes the mount Mirrored (and its private upstream is then required,
so the mirror can be read back), an absent one makes it ServeOnly (never writes
anywhere; the private upstream is optional, and a mount with neither is the pure
public gate). The coupling is structural, so a mirrored mount without a readable
private leg is unrepresentable.
Constructors
| Mirrored MirroredLegs | The mount mirrors admitted public artifacts; both legs are required. |
| ServeOnly (Maybe RegistryUrl) | The mount never writes; the optional private upstream is still merged when present. |
data MirroredLegs Source #
A mirrored mount's two required halves: the readable private upstream and the mirror target married to its derived write credential.
Constructors
| MirroredLegs | |
Fields
| |
Instances
| Show MirroredLegs Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> MirroredLegs -> ShowS # show :: MirroredLegs -> String # showList :: [MirroredLegs] -> ShowS # | |
| Eq MirroredLegs Source # | |
Defined in Ecluse.Config.Types | |
regPrivateUpstream :: MountRegistries -> Maybe RegistryUrl Source #
The mount's private upstream, when it has one: total over both modes, so call sites read as before while the compiler makes them face the serve-only absence.
regMirrorTarget :: MountRegistries -> Maybe MirrorTarget Source #
The mount's mirror target (with its derived credential), when it mirrors.
data MirrorTarget Source #
Constructors
| MirrorTarget | |
Fields
| |
Instances
| Show MirrorTarget Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> MirrorTarget -> ShowS # show :: MirrorTarget -> String # showList :: [MirrorTarget] -> ShowS # | |
| Eq MirrorTarget Source # | |
Defined in Ecluse.Config.Types | |
data MirrorCredential Source #
The mirror-write credential, derived from the mirror-target URL so a token
can never be paired with an endpoint it was not minted for. A CodeArtifact endpoint
encodes its whole identity in its host, so that identity is parsed straight from the
URL; any other host is written with an operator-supplied static bearer. The choice is
made once, at config load (resolveMirrorCredential),
and carried here so the pairing is correct by construction.
Constructors
| MirrorCodeArtifact CodeArtifactConfig | A CodeArtifact mirror target: the mint identity parsed from its host. |
| MirrorStatic Secret | Any other mirror target: an operator-supplied static write token. |
Instances
| Show MirrorCredential Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> MirrorCredential -> ShowS # show :: MirrorCredential -> String # showList :: [MirrorCredential] -> ShowS # | |
| Eq MirrorCredential Source # | |
Defined in Ecluse.Config.Types Methods (==) :: MirrorCredential -> MirrorCredential -> Bool # (/=) :: MirrorCredential -> MirrorCredential -> Bool # | |
data MountConfig Source #
Constructors
| MountConfig | |
Fields
| |
Instances
| FromJSON MountConfig Source # | |
Defined in Ecluse.Config.Aeson Methods parseJSON :: Value -> Parser MountConfig Source # parseJSONList :: Value -> Parser [MountConfig] Source # | |
| Show MountConfig Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> MountConfig -> ShowS # show :: MountConfig -> String # showList :: [MountConfig] -> ShowS # | |
| Eq MountConfig Source # | |
Defined in Ecluse.Config.Types | |
Constructors
| RuleEntry | |
Fields
| |
newtype RulePolicy Source #
Constructors
| RulePolicy | |
Fields
| |
Instances
| Show RulePolicy Source # | |
Defined in Ecluse.Config.Rule Methods showsPrec :: Int -> RulePolicy -> ShowS # show :: RulePolicy -> String # showList :: [RulePolicy] -> ShowS # | |
| Eq RulePolicy Source # | |
Defined in Ecluse.Config.Rule | |
data PolicyError Source #
Constructors
| MissingRuleType Text | |
| UnknownRuleType Text Text | |
| MalformedRule Text Text | |
| SuppressUnknownRule Text |
Instances
| Show PolicyError Source # | |
Defined in Ecluse.Config.Rule Methods showsPrec :: Int -> PolicyError -> ShowS # show :: PolicyError -> String # showList :: [PolicyError] -> ShowS # | |
| Eq PolicyError Source # | |
Defined in Ecluse.Config.Rule | |
renderPolicyError :: PolicyError -> Text Source #
data ConfigError Source #
Constructors
| ParseError Text | |
| PolicyErrors [PolicyError] | |
| PublicUrlRequired | A mount is active but |
| MountMissingPrivateUpstream Ecosystem | A mirrored mount (one that declares a |
| MirrorSettingWithoutWrite Ecosystem Text | A serve-only mount (no |
| MirrorCredentialTokenMissing Ecosystem | An active mount's mirror target is not a CodeArtifact endpoint (whose write token would be minted), so it needs an explicit static write token, and none was supplied. Carries the mount's ecosystem. |
| MirrorCredentialConflict Ecosystem | An active mount's mirror target is a CodeArtifact endpoint (its write token is minted automatically from the host identity) yet a static write token was also supplied. Refused so the two credential sources can never silently contend. Carries the mount's ecosystem. |
Instances
| Show ConfigError Source # | |
Defined in Ecluse.Config.Types Methods showsPrec :: Int -> ConfigError -> ShowS # show :: ConfigError -> String # showList :: [ConfigError] -> ShowS # | |
| Eq ConfigError Source # | |
Defined in Ecluse.Config.Types | |
renderConfigError :: ConfigError -> Text Source #
loadConfig :: [(String, String)] -> Maybe ByteString -> Either [ConfigError] Config Source #
Load the full configuration: defaults, the optional operator document, and the environment overlay, merged strongest-last, then parsed, activated, and resolved.
A mount is active when the operator overlay (the document or the
ECLUSE_MOUNTS__* environment variables) declares any key under
mounts.<ecosystem>; the mounts shipped in config/default.yaml are dormant
per-ecosystem templates until then. The enabled key is itself a declaration, so
enabled: true alone activates a mount against its template public upstream (the
serve-only pure public gate), and enabled: false switches a mount off without
removing its other keys.
Whether an active mount mirrors is derived from its declared endpoints: a
mirrorTarget makes it mirrored (its private upstream is then required, so the
mirror can be read back: MountMissingPrivateUpstream), and an absent one makes it
serve-only (never writing anywhere; a mirror-write setting left behind is refused
per key as MirrorSettingWithoutWrite rather than silently ignored). The boot log
names each mount's resolved posture, so an unintentionally dropped mirrorTarget
is visible at start-up.
mountCollisionWarnings :: Config -> [Text] Source #
Boot-time advisory: one warning per pair of an active mount's resolved registry endpoints that point at the same registry. Each collapse is supported by the proxy (declaring the mirror target equal to the private upstream is a valid arrangement), but a distinct registry per endpoint is the recommended posture, so every collision is surfaced once at boot. A publication target equal to the private upstream is the documented publish arrangement and is not warned. Comparison is textual on the validated URL, insensitive to trailing slashes.
mountPostureLines :: Config -> [Text] Source #
Boot-time posture: one line per served mount naming its derived mode and its
consequence. The mode is derived from the declared endpoints (see loadConfig), so
this is the loud counterpart of that inference: an unintentionally dropped
mirrorTarget shows up here as "serve-only" at the very next boot rather than
silently un-mirroring.
resolvedKeyProvenance :: [(String, String)] -> Maybe ByteString -> [Text] Source #
One line per resolved leaf of the merged configuration: the dotted path, the
rendered value (secret-typed keys redacted), and the layer that supplied it
(environment > document > default, mirroring the merge precedence). Derived and
computed values are deliberately absent: they are not configuration, and their
resolvers log their own provenance lines (the runtime posture, the memory plan,
the queue selection). Renders nothing if the layers fail to parse; callers dump
provenance only after a successful loadConfig.