Move per-vhost policy derivation into toNginxVirtualHost (tracks IR#7) #44

Open
opened 2026-06-21 14:07:40 +02:00 by yorunikakeru · 0 comments
Owner

Context

IR#7 adds vhostPolicies :: [Policy] to NginxVirtualHost. Once that lands, the DSL needs to be updated to populate the new field and stop attaching vhost-level policies to the module-level nginxPolicies.

Changes required

src/Module/Nginx/VirtualHost.hs

  • toNginxVirtualHost currently ignores vhFallbacks and produces no policies.
  • After IR#7: derive per-vhost allow-ports + fallback policies from vhFallbacks and populate vhostPolicies in the resulting NginxVirtualHost.

src/Module/Nginx.hs

  • derivePolicies currently collects vhost ports and builds module-level policies from them.
  • After the move: strip out the vhost-sourced policy derivation. Module-level nginxPolicies should contain only policies that genuinely belong to the whole module (if any). If none remain, the field may be left empty.

Test fixtures

Update to include the new vhostPolicies field:

  • test/fixtures/nginx-module.json
  • test/fixtures/nginx-virtual-host.json
  • test/fixtures/server-stack.json

Dependency

Blocked on FrogOS/IR#7 merging and nix flake update picking up the new IR revision.

## Context IR#7 adds `vhostPolicies :: [Policy]` to `NginxVirtualHost`. Once that lands, the DSL needs to be updated to populate the new field and stop attaching vhost-level policies to the module-level `nginxPolicies`. ## Changes required ### `src/Module/Nginx/VirtualHost.hs` - `toNginxVirtualHost` currently ignores `vhFallbacks` and produces no policies. - After IR#7: derive per-vhost allow-ports + fallback policies from `vhFallbacks` and populate `vhostPolicies` in the resulting `NginxVirtualHost`. ### `src/Module/Nginx.hs` - `derivePolicies` currently collects vhost ports and builds module-level policies from them. - After the move: strip out the vhost-sourced policy derivation. Module-level `nginxPolicies` should contain only policies that genuinely belong to the whole module (if any). If none remain, the field may be left empty. ### Test fixtures Update to include the new `vhostPolicies` field: - `test/fixtures/nginx-module.json` - `test/fixtures/nginx-virtual-host.json` - `test/fixtures/server-stack.json` ## Dependency Blocked on `FrogOS/IR#7` merging and `nix flake update` picking up the new IR revision.
Sign in to join this conversation.
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#44
No description provided.