feat: allow changing the hostname (restic host) (#240)

This commit is contained in:
Nico
2025-12-26 21:02:16 +01:00
committed by GitHub
parent d5c0f91a9f
commit 54068d5269
2 changed files with 7 additions and 0 deletions

View File

@@ -5,11 +5,13 @@ const envSchema = type({
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
SERVER_IP: 'string = "localhost"',
SERVER_IDLE_TIMEOUT: 'string.integer.parse = "60"',
RESTIC_HOSTNAME: "string = 'zerobyte'",
}).pipe((s) => ({
__prod__: s.NODE_ENV === "production",
environment: s.NODE_ENV,
serverIp: s.SERVER_IP,
serverIdleTimeout: s.SERVER_IDLE_TIMEOUT,
resticHostname: s.RESTIC_HOSTNAME,
}));
const parseConfig = (env: unknown) => {

View File

@@ -5,6 +5,7 @@ import os from "node:os";
import { throttle } from "es-toolkit";
import { type } from "arktype";
import { REPOSITORY_BASE, RESTIC_PASS_FILE, DEFAULT_EXCLUDES } from "../core/constants";
import { config as appConfig } from "../core/config";
import { logger } from "./logger";
import { cryptoUtils } from "./crypto";
import type { RetentionPolicy } from "../modules/backups/backups.dto";
@@ -262,6 +263,10 @@ const backup = async (
args.push("--one-file-system");
}
if (appConfig.resticHostname) {
args.push("--host", appConfig.resticHostname);
}
if (options?.tags && options.tags.length > 0) {
for (const tag of options.tags) {
args.push("--tag", tag);