ops/nixos/quotes.bfob.gg: add my.quotesdb.listen option

This commit is contained in:
Luke Granger-Brown 2021-01-20 00:21:21 +00:00
parent b0993ffd70
commit 5ee6a1c3b7
2 changed files with 26 additions and 2 deletions

View file

@ -305,5 +305,10 @@ in {
};
};
my.quotesdb.listen = [
"185.198.188.29"
"[2a0a:54c0:0:17::2]"
];
system.stateVersion = "20.09";
}

View file

@ -1,4 +1,4 @@
{ config, depot, lib, ... }:
{ config, options, depot, lib, ... }:
let
inherit (depot.ops) secrets;
@ -7,7 +7,24 @@ let
sock = "/run/quotesdb/gunicorn.sock";
in
{
config = {
options = with lib; {
my.quotesdb.listen = lib.mkOption {
type = with types; listOf str;
default = [ "127.0.0.1" "[::1]" ];
};
};
config = let
nginxListen = (map (addr: {
inherit addr;
port = 80;
ssl = false;
}) config.my.quotesdb.listen) ++ (map (addr: {
inherit addr;
port = 443;
ssl = true;
}) config.my.quotesdb.listen);
in {
security.acme = {
acceptTerms = true;
email = lib.mkDefault "letsencrypt@lukegb.com";
@ -21,11 +38,13 @@ in
services.nginx = {
enable = lib.mkDefault true;
virtualHosts."qdb.bfob.gg" = {
listen = nginxListen;
useACMEHost = "bfob.gg";
globalRedirect = "quotes.bfob.gg";
forceSSL = true;
};
virtualHosts."quotes.bfob.gg" = {
listen = nginxListen;
useACMEHost = "bfob.gg";
forceSSL = true;
locations."/static" = {