mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Use configuration options for remaining hardcoded values in module
This commit is contained in:
@@ -66,6 +66,10 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
package = localArchtikaPackage;
|
package = localArchtikaPackage;
|
||||||
jwtSecret = "a42kVyAhTImYxZeebZkApoAZLmf0VtDA";
|
jwtSecret = "a42kVyAhTImYxZeebZkApoAZLmf0VtDA";
|
||||||
|
domain = "demo.archtika.com";
|
||||||
|
acmeEmail = "thilo.hohlt@tutanota.com";
|
||||||
|
dnsProvider = "porkbun";
|
||||||
|
dnsEnvironmentFile = /var/lib/porkbun.env;
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "24.11";
|
system.stateVersion = "24.11";
|
||||||
|
|||||||
@@ -50,6 +50,30 @@ in
|
|||||||
default = 10000;
|
default = 10000;
|
||||||
description = "Port on which the web application runs.";
|
description = "Port on which the web application runs.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
domain = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Domain to use for the application.";
|
||||||
|
};
|
||||||
|
|
||||||
|
acmeEmail = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Email to notify for the SSL certificate renewal process.";
|
||||||
|
};
|
||||||
|
|
||||||
|
dnsProvider = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
description = "DNS provider for the DNS-01 challenge (required for wildcard domains).";
|
||||||
|
};
|
||||||
|
|
||||||
|
dnsEnvironmentFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = null;
|
||||||
|
description = "API secrets for the DNS-01 challenge (required for wildcard domains).";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@@ -104,7 +128,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
ORIGIN=https://demo.archtika.com PORT=${toString cfg.webAppPort} ${pkgs.nodejs_22}/bin/node ${cfg.package}/web-app
|
ORIGIN=https://${cfg.domain} PORT=${toString cfg.webAppPort} ${pkgs.nodejs_22}/bin/node ${cfg.package}/web-app
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,8 +153,8 @@ in
|
|||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"demo.archtika.com" = {
|
"${cfg.domain}" = {
|
||||||
useACMEHost = "demo.archtika.com";
|
useACMEHost = cfg.domain;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
@@ -156,8 +180,8 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"~^(?<subdomain>.+)\\.demo\\.archtika\\.com$" = {
|
"~^(?<subdomain>.+)\\.${lib.strings.escapeRegex cfg.domain}$" = {
|
||||||
useACMEHost = "demo.archtika.com";
|
useACMEHost = cfg.domain;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
@@ -172,12 +196,12 @@ in
|
|||||||
|
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
defaults.email = "thilo.hohlt@tutanota.com";
|
defaults.email = cfg.acmeEmail;
|
||||||
certs."demo.archtika.com" = {
|
certs."${cfg.domain}" = {
|
||||||
domain = "demo.archtika.com";
|
domain = cfg.domain;
|
||||||
extraDomainNames = ["*.demo.archtika.com"];
|
extraDomainNames = [ "*.${cfg.domain}" ];
|
||||||
dnsProvider = "porkbun";
|
dnsProvider = cfg.dnsProvider;
|
||||||
environmentFile = /var/lib/porkbun.env;
|
environmentFile = cfg.dnsEnvironmentFile;
|
||||||
group = config.services.nginx.group;
|
group = config.services.nginx.group;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
|||||||
logoType: websiteData.logo_type,
|
logoType: websiteData.logo_type,
|
||||||
logo: websiteData.logo_text,
|
logo: websiteData.logo_text,
|
||||||
coverImage: article.cover_image
|
coverImage: article.cover_image
|
||||||
? `${API_BASE_PREFIX === "/api" ? "https://demo.archtika.com/api" : API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
? `${API_BASE_PREFIX === "/api" ? `${process.env.ORIGIN}/api` : API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
||||||
: "",
|
: "",
|
||||||
publicationDate: article.publication_date,
|
publicationDate: article.publication_date,
|
||||||
mainContent: md.render(article.main_content ?? ""),
|
mainContent: md.render(article.main_content ?? ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user