Make viewer accept config files

This commit is contained in:
deajan 2024-04-22 13:06:50 +02:00
parent 53fcb9ed8b
commit 0f66c830c2
2 changed files with 27 additions and 12 deletions

View file

@ -72,6 +72,12 @@ While restic is a fanstastic program, NPBackup expands restic by offering a wide
## Quickstart
NPBackup consists of four programs:
- npbackup-cli: CLI version of the backup program
- npbackup-gui: GUI version of the backup program, useful to create YAML config files
- npbackup-viewer: View and restore restic repositories without configuration
- upgrade_server: Separate server to provide npbackup clients with newer binaries
You may install npbackup via PyPI or use the pre-built executables.
### Prebuilt executables
@ -144,6 +150,12 @@ This allows a system admin to see repo URI and passwords, without leaving this i
The configuration file should never be world readable, as one could change the backup admin password, allowing to decrypt other parts of the conf file.
### NPBackup viewer
`npbackup-viewer` provides an easy to use GUI to view contents of various restic repositories, and restore files.
It accepts npbackup configuration files, restic style `RESTIC_REPOSITORY` and `RESTIC_PASSWORD` environment variables, and can virtually open any restic repository.
## The difficulty of laptop backups
As a matter of fact, laptop backups are the hardest. No one can predict when a laptop is on, and if it has access to internet.

View file

@ -654,7 +654,20 @@ def _main_gui(viewer_mode: bool):
repo_list,
)
if not viewer_mode:
# FN ENTRY POINT
# Let's try to read standard restic repository env variables
viewer_repo_uri = os.environ.get("RESTIC_REPOSITORY", None)
viewer_repo_password = os.environ.get("RESTIC_PASSWORD", None)
if viewer_mode and not config_file:
if viewer_repo_uri and viewer_repo_password:
repo_config = viewer_create_repo(viewer_repo_uri, viewer_repo_password)
else:
repo_config = None
config_file = None
full_config = None
backend_type = None
else:
(
full_config,
config_file,
@ -664,17 +677,7 @@ def _main_gui(viewer_mode: bool):
repo_uri,
repo_list,
) = get_config(config_file=config_file)
else:
# Let's try to read standard restic repository env variables
viewer_repo_uri = os.environ.get("RESTIC_REPOSITORY", None)
viewer_repo_password = os.environ.get("RESTIC_PASSWORD", None)
if viewer_repo_uri and viewer_repo_password:
repo_config = viewer_create_repo(viewer_repo_uri, viewer_repo_password)
else:
repo_config = None
config_file = None
full_config = None
backend_type = None
right_click_menu = ["", [_t("generic.destination")]]
headings = [