Commit graph

9 commits

Author SHA1 Message Date
Jakub Trávník
b0d9985964
Merge branch 'main' into config-import-json 2026-01-03 12:08:38 +01:00
Nicolas Meienberger
5d7c6bd543 fix: cli not running with prod image 2026-01-02 15:22:44 +01:00
Jakub Trávník
8591432c59 refactor: add ArkType schema validation for config import
- Add app/schemas/config-import.ts with ArkType schemas for upfront validation
- Replace runtime type checks with schema-based validation in config-import.ts
- Return validation errors early with detailed path and message info
- Export retentionPolicySchema from backups.dto.ts for reuse
- Update CLI to handle validation errors in both dry-run and import modes
- Fix README mirrors examples to use existing repository names
2026-01-02 14:02:06 +01:00
Jakub Trávník
24f850b3b9 refactor: move toError function to utils/errors for reuse across modules 2026-01-02 11:54:26 +01:00
Jakub Trávník
88bb174423 feat: add option to overwrite recovery key during config import and prevent overwrite if database is not empty 2026-01-02 10:19:20 +01:00
Jakub Trávník
60c0778b74 refactor: improve config import logging, add CLI JSON output and idempotent re-runs
- Add `--json` flag for machine-readable JSON output
- Add `--log-level` flag to control logging verbosity
- Add `skipped` counter to ImportResult for idempotent operations
- Change "already exists" conditions from warnings to skipped (info logs)
- Recovery key mismatch now errors and stops import early
- Pre-check volumes and notification destinations before creation
- Attachment functions merge missing items instead of overwriting
- Add toError() and mergeResults() helpers to reduce code duplication
- Extract readConfigJson() and createOutput() for cleaner CLI code
- Move fs/path imports to top level in config-import.ts
2025-12-30 12:39:02 +01:00
Jakub Trávník
5a4f4641b4 feat: improve config import with result tracking and idempotent repository detection
- Add ImportResult type to track succeeded/warnings/errors counts across all import functions
- Implement multi-layer repository duplicate detection:
  - URL-based check (same path/bucket/endpoint already registered)
  - Restic repo check (path is already a restic repository)
  - Name-based fallback check
- Standardize logging between CLI and env var import methods with logImportSummary()
- CLI exits with code 1 when import has errors
- Remove shortId override for local repo migrations (use full path with isExistingRepository instead)
- Update example JSON and README:
  - Document that local repo path is optional (defaults to /var/lib/zerobyte/repositories)
  - Add existing-local-repo example with isExistingRepository: true
  - Add S3 endpoint field to example
  - Expand config behavior docs to explain all repository skip conditions
- Improve .gitignore to exclude all JSON except example template
2025-12-29 18:34:02 +01:00
Jakub Trávník
45b5c0d752 feat(cli): add import-config command for manual config import
Add CLI command to import configuration from file or stdin, providing
an alternative to the env-var-based automatic import on startup.

Features:
- `import-config --config <path>` to import from a mounted file
- `import-config --stdin` to import from piped input (no file mount needed)
- `import-config --dry-run` to validate config without importing

Changes:
- Add app/server/cli/commands/import-config.ts with new command
- Register importConfigCommand in CLI index
- Refactor config-import.ts: extract runImport() and add applyConfigImport()
  for direct config object import (used by CLI)
- Update docs with both import methods (env var and CLI examples)
2025-12-29 11:04:12 +01:00
Nico
c69d2b6445
feat: reset password cli command (#220)
* feat: reset password cli command

* refactor: wrap user password reset operations in db transaction
2025-12-22 19:20:37 +01:00