feat/modules #45

Merged
yorunikakeru merged 6 commits from feat/modules into main 2026-06-21 14:45:07 +02:00
Owner
No description provided.
Removes three copies of `toWord16 :: Int -> Word16` and three copies of
the `either (error "impossible") id (mkModuleName "...")` pattern, each
previously duplicated across Forgejo, Nginx, and PostgreSQL builders.
Removes IsPort typeclass, Num PortSpec instance, and withFallback.
All port builder functions now take Int for the primary port; fallback
variants (httpPortWithFallback, httpsPortWithFallback, sshPortWithFallback,
portWithFallback) take Int -> [Int] -> builder (), making the fallback
intent explicit and eliminating the silent data loss on PortSpec arithmetic.
All builder functions take PortSpec again. Port exposes two clean constructors:
  port :: Int -> PortSpec          -- simple case
  withFallback :: Int -> [Int] -> PortSpec  -- with fallbacks

Usage: httpPort (port 80), httpsPort (443 `withFallback` [80]).
Removes the per-module *WithFallback duplicates added in the previous commit.
STAN-0206 (non-strict fields) is a false positive: StrictData is already
enabled globally for the library via default-extensions in DSL.cabal.
Exclude the inspection project-wide rather than adding redundant ! annotations.
refactor(nginx): move vhost policies from module to virtual host level
All checks were successful
CI / linux (pull_request) Successful in 1m59s
db6a37d0bc
`derivePolicies` lived on `NginxState`, aggregating across all vhosts.
Policies now derived per `NginxVHostState` and stored in `vhostPolicies`;
`nginxPolicies` is always empty.

Also extracts `validatePortSpec` to eliminate the duplicated port
validation block shared by `httpPort` and `httpsPort`.
refactor(module): replace hardcodedModuleName with moduleDomainName
All checks were successful
CI / linux (pull_request) Successful in 1m59s
b17b2b92b6
Module builders now derive names via Domain.Module.moduleDomainName
instead of repeating a partial Text → ModuleName conversion locally.
toWord16 also removed in favour of inline fromIntegral.

docs: update README for module architecture — services → modules,
Service/ServiceBuilder → Module/ConfigBuilder, IR JSON version 6,
add module builder examples and package declarations.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
FrogOS/DSL!45
No description provided.