chore: reformat the codebase

This commit is contained in:
Gabriel Arazas 2023-02-09 14:51:22 +08:00
parent ae787f8fcc
commit 1c609f5e95
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 35 additions and 26 deletions

View File

@ -26,17 +26,22 @@ rec {
ipv6Gateway = "fe80::1"; ipv6Gateway = "fe80::1";
in in
{ {
# This is the public-facing interface. Any interface name with a prime # This is the public-facing interface. Any interface name with a prime
# symbol means it's a public-facing interface. # symbol means it's a public-facing interface.
main' = { main' = {
# The gateways for the public addresses are retrieved from the following # The gateways for the public addresses are retrieved from the following
# pages: # pages:
# #
# * https://docs.hetzner.com/cloud/networks/faq/#are-any-ip-addresses-reserved # * https://docs.hetzner.com/cloud/networks/faq/#are-any-ip-addresses-reserved
# * https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/#gateway # * https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/#gateway
IPv4 = { IPv4 = {
address = "65.109.224.213"; address = "65.109.224.213";
gateway = "172.31.1.1"; gateway = "172.31.1.1";
};
IPv6 = {
address = "2a01:4f9:c012:607a::1";
gateway = ipv6Gateway;
};
}; };
internal = { internal = {

View File

@ -47,7 +47,8 @@ let
domainZoneFile' = "/etc/coredns/zones/${domain}.zone"; domainZoneFile' = "/etc/coredns/zones/${domain}.zone";
in in
{ {
sops.secrets = let sops.secrets =
let
getKey = key: { getKey = key: {
inherit key; inherit key;
sopsFile = ../../secrets/secrets.yaml; sopsFile = ../../secrets/secrets.yaml;
@ -58,8 +59,8 @@ in
lib.nameValuePair lib.nameValuePair
"plover/${secret}" "plover/${secret}"
((getKey secret) // config)) ((getKey secret) // config))
secrets; secrets;
in in
getSecrets { getSecrets {
"dns/mailbox-security-key" = { }; "dns/mailbox-security-key" = { };
"dns/mailbox-security-key-record" = { }; "dns/mailbox-security-key-record" = { };

View File

@ -78,13 +78,14 @@ in
# This is based from the reverse proxy guide from the official # This is based from the reverse proxy guide from the official
# documentation at https://www.keycloak.org/server/reverseproxy. # documentation at https://www.keycloak.org/server/reverseproxy.
locations = let locations =
keycloakPath = path: "http://${host}:${toString config.services.keycloak.settings.http-port}"; let
in keycloakPath = path: "http://${host}:${toString config.services.keycloak.settings.http-port}";
lib.listToAttrs in
(lib.lists.map lib.listToAttrs
(appPath: lib.nameValuePair appPath { proxyPass = keycloakPath appPath; }) (lib.lists.map
[ "/js/" "/realms/" "/resources/" "/robots.txt" ]); (appPath: lib.nameValuePair appPath { proxyPass = keycloakPath appPath; })
[ "/js/" "/realms/" "/resources/" "/robots.txt" ]);
}; };
"${authInternalDomain}" = { "${authInternalDomain}" = {

View File

@ -71,11 +71,13 @@ in
{ {
routeConfig = { routeConfig = {
Gateway = wireguardPeers.server.IPv4; Gateway = wireguardPeers.server.IPv4;
Destination = let Destination =
ip = lib.strings.splitString "." wireguardPeers.server.IPv4; let
properRange = lib.lists.take 3 ip ++ [ "0" ]; ip = lib.strings.splitString "." wireguardPeers.server.IPv4;
ip' = lib.concatStringsSep "." properRange; properRange = lib.lists.take 3 ip ++ [ "0" ];
in "${ip'}/16"; ip' = lib.concatStringsSep "." properRange;
in
"${ip'}/16";
}; };
} }
]; ];