Use nginx to refer requests to objectifier.

This commit is contained in:
niten 2023-03-19 09:56:51 -07:00
parent 365fa386c6
commit 52034eaae7
1 changed files with 23 additions and 6 deletions

View File

@ -29,6 +29,12 @@ in {
default = 3;
};
pool-size = mkOption {
type = int;
description = "Number of nets to initialize.";
default = 5;
};
listen-addresses = mkOption {
type = listOf str;
description =
@ -36,18 +42,18 @@ in {
default = [ "127.0.0.1" ];
};
pool-size = mkOption {
type = int;
description = "Number of nets to initialize.";
default = 5;
};
detection-timeout = mkOption {
type = int;
description = "Time in seconds to allow for detection to start.";
default = 5;
};
hostname = mkOption {
type = nullOr str;
description = "Hostname on which to listen for requests.";
default = null;
};
cleanup = {
max_file_age = mkOption {
type = int;
@ -65,6 +71,17 @@ in {
};
config = mkIf cfg.enable {
services.nginx = mkIf (!isNull cfg.hostname) {
enable = true;
recommendedOptimisations = true;
recommendedProxySettings = true;
recommendedGzipSettings = true;
virtualHosts."${cfg.hostname}" = {
locations."/".proxyPass = "http://127.0.0.1:${toString cfg.port}";
};
};
systemd.services.objectifier = {
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];