diff options
Diffstat (limited to 'apps/static-website/module.nix')
-rw-r--r-- | apps/static-website/module.nix | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/static-website/module.nix b/apps/static-website/module.nix index 659dfad..32fed09 100644 --- a/apps/static-website/module.nix +++ b/apps/static-website/module.nix @@ -1,4 +1,11 @@ -{ appConfig, ... }: { - services.nginx.enable = true; - services.nginx.virtualHosts.${appConfig.domain}.locations."/".root = appConfig.root; -} +{ appConfig, lib, ... }: lib.mkMerge [ + { + services.nginx.enable = true; + services.nginx.virtualHosts.${appConfig.domain}.locations."/".root = appConfig.root; + } + (lib.mkIf (appConfig.cors != null) { + services.nginx.virtualHosts.${appConfig.domain}.locations."/".extraConfig = '' + add_header 'Access-Control-Allow-Origin' '${appConfig.cors}'; + ''; + }) +] |