/* This file is part of »mimir«. Copyright 2025 kcf »mimir« is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. »mimir« is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with »mimir«. If not, see . */ namespace _mimir.conf { /** */ export const schema : lib_plankton.conf.type_schema = { "nullable": false, "type": "object", "properties": { "settings": { "nullable": false, "type": "object", "properties": { "temp_directory": { "nullable": false, "type": "string", "default": "/tmp/mimir" } }, "additionalProperties": false, "required": [ ], "default": {} }, "target": { "anyOf": [ { "nullable": false, "type": "object", "properties": { "kind": { "nullable": false, "type": "string", "enum": ["local"] }, "parameters": { "nullable": false, "type": "object", "properties": { "directory": { "nullable": false, "type": "string" }, }, "additionalProperties": false, "required": [ "directory", ] }, }, "additionalProperties": false, "required": [ "kind", "parameters", ] }, { "nullable": false, "type": "object", "properties": { "kind": { "nullable": false, "type": "string", "enum": ["borg"] }, "parameters": { "nullable": false, "type": "object", "properties": { "repository": { "nullable": false, "type": "string" }, "compression": { "nullable": false, "type": "string", "enum": [ "none", "lz4", "zlib", "lzma", ], "default": "lz4" }, "pruning": { "nullable": false, "type": "object", "properties": { "keep_weekly": { "nullable": false, "type": "integer", "default": 7 }, "keep_yearly": { "nullable": false, "type": "integer", "default": 2 }, }, "additionalProperties": false, "required": [ ], "default": {} } }, "required": [ "repository", ] }, }, "additionalProperties": false, "required": [ "kind", "parameters", ] } ] }, /* "defaults": { }, */ "concerns": { "nullable": false, "type": "array", "items": { "anyOf": [ { "nullable": false, "type": "object", "properties": { "active": { "nullable": false, "type": "boolean", "default": true }, "name": { "nullable": false, "type": "string" }, "kind": { "nullable": false, "type": "string", "enum": ["files"] }, "parameters": { "nullable": false, "type": "object", "properties": { "path": { "nullable": false, "type": "string", }, }, "additionalProperties": false, "required": [ "path", ] } }, "additionalProperties": false, "required": [ "name", "kind", "parameters", ] }, { "nullable": false, "type": "object", "properties": { "active": { "nullable": false, "type": "boolean", "default": true }, "name": { "nullable": false, "type": "string" }, "kind": { "nullable": false, "type": "string", "enum": ["postgresql_dump"] }, "parameters": { "nullable": false, "type": "object", "properties": { "credentials": { "nullable": false, "type": "object", "properties": { "host": { "nullable": false, "type": "string", }, "port": { "nullable": false, "type": "integer", "default": 5432 }, "username": { "nullable": false, "type": "string", }, "password": { "nullable": false, "type": "string", }, "schema": { "nullable": false, "type": "string", }, }, "additionalProperties": false, "required": [ "host", "username", "password", "schema", ] }, }, "additionalProperties": false, "required": [ "credentials", ] } }, "additionalProperties": false, "required": [ "name", "kind", "parameters", ] }, ] } }, }, "additionalProperties": false, "required": [ "version", "target", "concerns", ] }; /** */ type type_settings = { temp_directory : string; }; /** */ type type_target_parameters_local = { directory : string; }; /** */ type type_target_parameters_borg = { repository : string; compression : string; pruning : { keep_weekly : int; keep_yearly : int; } }; /** */ type type_concern_parameters_files = { name : string; path : string; }; /** */ export type type_target = ( { kind : "local"; parameters : type_target_parameters_local; } | { kind : "borg"; parameters : type_target_parameters_borg; } ); /** */ type type_concern_parameters_postgresql_dump = { credentials : { host : string; port : int; username : string; password : string; schema : string; }; }; /** */ export type type_concern = ( { kind : "files"; parameters : type_concern_parameters_files; } | { kind : "postgresql_dump"; parameters : type_concern_parameters_postgresql_dump; } ); /** */ type type_root = { settings : type_settings; target : type_target; concerns : Array< { active ?: boolean; name : string; } & type_concern >; }; /** */ export type type_conf = type_root; /** */ export function get( path : string ) : Promise { return lib_plankton.conf.load( schema, path ); } }