Skip to content

Commit 5195415

Browse files
committed
Add NPBACKUP_BACKEND_BINARY as env variable
1 parent e3ddc45 commit 5195415

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

npbackup/core/runner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,15 @@ def _apply_config_to_restic_runner(self) -> bool:
912912
self.write_logs("No backend binary found", level="error")
913913
self._is_ready = False
914914
return False
915+
916+
# Add currently in use backend binary to environment variables
917+
# This is useful for additional parameters / scripts that would directly call the backend
918+
try:
919+
os.environ["NPBACKUP_BACKEND_BINARY"] = str(self.restic_runner.binary)
920+
except OSError:
921+
self.write_logs(
922+
f"Cannot set env variable NPBACKUP_BACKEND_BINARY to {self.binary}", level="error"
923+
)
915924
return True
916925

917926
def convert_to_json_output(

0 commit comments

Comments
 (0)