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; default = 3;
}; };
pool-size = mkOption {
type = int;
description = "Number of nets to initialize.";
default = 5;
};
listen-addresses = mkOption { listen-addresses = mkOption {
type = listOf str; type = listOf str;
description = description =
@ -36,18 +42,18 @@ in {
default = [ "127.0.0.1" ]; default = [ "127.0.0.1" ];
}; };
pool-size = mkOption {
type = int;
description = "Number of nets to initialize.";
default = 5;
};
detection-timeout = mkOption { detection-timeout = mkOption {
type = int; type = int;
description = "Time in seconds to allow for detection to start."; description = "Time in seconds to allow for detection to start.";
default = 5; default = 5;
}; };
hostname = mkOption {
type = nullOr str;
description = "Hostname on which to listen for requests.";
default = null;
};
cleanup = { cleanup = {
max_file_age = mkOption { max_file_age = mkOption {
type = int; type = int;
@ -65,6 +71,17 @@ in {
}; };
config = mkIf cfg.enable { 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 = { systemd.services.objectifier = {
after = [ "network-online.target" ]; after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];