diff options
| author | seth <[email protected]> | 2024-07-09 05:25:23 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-07-09 15:38:51 -0400 |
| commit | 01be52c037e8a457ac51bd37b755295baa7c83c6 (patch) | |
| tree | c060f18870c7a1505d6b241b32036fbbc59542f5 /lib/nginx.nix | |
| parent | f9b9476089f74547a8f04484e7c9a4b369c9d1ef (diff) | |
lib: use rfc0145 doc-strings
Diffstat (limited to 'lib/nginx.nix')
| -rw-r--r-- | lib/nginx.nix | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/lib/nginx.nix b/lib/nginx.nix index e7c22c3..c2c99fb 100644 --- a/lib/nginx.nix +++ b/lib/nginx.nix @@ -1,7 +1,28 @@ lib: { - # string -> int -> { } - # create an nginx virtualHost submodule proxying local port - # `port` to `endpoint` + /** + Create an NGINX virtualHost submodule proxying a local port + + # Example + + ```nix + mkProxy "/" "3000" + => { + proxyPass = "http://localhost:3000"; + proxyWebsockets = true; + } + ``` + + # Type + + ``` + mkProxy :: String -> Number -> AttrSet + ``` + + # Arguments + + - [endpoint] virtualHost endpoint that `port` will be proxied towards + - [port] Port to be proxied + */ mkProxy = endpoint: port: { "${endpoint}" = { proxyPass = "http://localhost:${toString port}"; @@ -9,8 +30,30 @@ lib: { }; }; - # string -> { } -> { } - # transform the names of an attribute set of nginx virtualHosts - # into a full subdomain + /** + Transform the names of an attribute set of nginx virtualHosts into a full subdomain + + # Example + + ```nix + toVHosts "example.com" { + subdomain = { }; + } + => { + "subdomain.example.com" = { }; + } + ``` + + # Type + + ``` + toVHosts :: String -> AttrSet -> AttrSet + ``` + + # Arguments + + - [domain] Root domain used + - [subdomainMap] A name value pair of subdomains and their virtualHost options + */ toVHosts = domain: lib.mapAttrs' (name: lib.nameValuePair "${name}.${domain}"); } |
