feat: allow changing the hostname (restic host) (#240)
This commit is contained in:
parent
d5c0f91a9f
commit
54068d5269
2 changed files with 7 additions and 0 deletions
|
|
@ -5,11 +5,13 @@ const envSchema = type({
|
||||||
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
|
NODE_ENV: type.enumerated("development", "production", "test").default("production"),
|
||||||
SERVER_IP: 'string = "localhost"',
|
SERVER_IP: 'string = "localhost"',
|
||||||
SERVER_IDLE_TIMEOUT: 'string.integer.parse = "60"',
|
SERVER_IDLE_TIMEOUT: 'string.integer.parse = "60"',
|
||||||
|
RESTIC_HOSTNAME: "string = 'zerobyte'",
|
||||||
}).pipe((s) => ({
|
}).pipe((s) => ({
|
||||||
__prod__: s.NODE_ENV === "production",
|
__prod__: s.NODE_ENV === "production",
|
||||||
environment: s.NODE_ENV,
|
environment: s.NODE_ENV,
|
||||||
serverIp: s.SERVER_IP,
|
serverIp: s.SERVER_IP,
|
||||||
serverIdleTimeout: s.SERVER_IDLE_TIMEOUT,
|
serverIdleTimeout: s.SERVER_IDLE_TIMEOUT,
|
||||||
|
resticHostname: s.RESTIC_HOSTNAME,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const parseConfig = (env: unknown) => {
|
const parseConfig = (env: unknown) => {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import os from "node:os";
|
||||||
import { throttle } from "es-toolkit";
|
import { throttle } from "es-toolkit";
|
||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { REPOSITORY_BASE, RESTIC_PASS_FILE, DEFAULT_EXCLUDES } from "../core/constants";
|
import { REPOSITORY_BASE, RESTIC_PASS_FILE, DEFAULT_EXCLUDES } from "../core/constants";
|
||||||
|
import { config as appConfig } from "../core/config";
|
||||||
import { logger } from "./logger";
|
import { logger } from "./logger";
|
||||||
import { cryptoUtils } from "./crypto";
|
import { cryptoUtils } from "./crypto";
|
||||||
import type { RetentionPolicy } from "../modules/backups/backups.dto";
|
import type { RetentionPolicy } from "../modules/backups/backups.dto";
|
||||||
|
|
@ -262,6 +263,10 @@ const backup = async (
|
||||||
args.push("--one-file-system");
|
args.push("--one-file-system");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (appConfig.resticHostname) {
|
||||||
|
args.push("--host", appConfig.resticHostname);
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.tags && options.tags.length > 0) {
|
if (options?.tags && options.tags.length > 0) {
|
||||||
for (const tag of options.tags) {
|
for (const tag of options.tags) {
|
||||||
args.push("--tag", tag);
|
args.push("--tag", tag);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue