Ver código fonte

Environment variables are useless with a proper configuration

jherve 1 mês atrás
pai
commit
c852f8b36d
2 arquivos alterados com 5 adições e 10 exclusões
  1. 2 2
      README.md
  2. 3 8
      pc_backup/cli.py

+ 2 - 2
README.md

@@ -5,5 +5,5 @@
 
 Note : This can also be done this way :
 
-1. `BORG_PASSPHRASE_NAME=<passphrase_name> STORAGE_BOX_USER=<user> SSH_KEY_NAME=<name> python3 start.py create_repo`
-1. `BORG_PASSPHRASE_NAME=<passphrase_name> STORAGE_BOX_USER=<user> SSH_KEY_NAME=<name> python3 start.py export_key`
+1. `my-backup create_repo`
+1. `my-backup export_key`

+ 3 - 8
pc_backup/cli.py

@@ -108,10 +108,9 @@ class CommandRm(Command):
 class CommandExec(Command):
     command = "exec"
     help = "run command in container"
-    env_vars = ["BORG_PASSPHRASE_NAME", "STORAGE_BOX_USER", "SSH_KEY_NAME"]
 
     def run(self, *, container: BorgmaticContainer, **kwargs):
-        container.exec(self.extra, self.env_vars)
+        container.exec(self.extra)
 
 
 class CommandBash(Command):
@@ -125,21 +124,17 @@ class CommandBash(Command):
 class CommandCreateRepo(Command):
     command = "create_repo"
     help = "create repository"
-    env_vars = ["BORG_PASSPHRASE_NAME", "STORAGE_BOX_USER", "SSH_KEY_NAME"]
 
     def run(self, *, container: BorgmaticContainer, **kwargs):
-        container.exec(
-            ["borgmatic", "repo-create", "--encryption", "repokey"], self.env_vars
-        )
+        container.exec(["borgmatic", "repo-create", "--encryption", "repokey"])
 
 
 class CommandExportKey(Command):
     command = "export_key"
     help = "export the repository key"
-    env_vars = ["BORG_PASSPHRASE_NAME", "STORAGE_BOX_USER", "SSH_KEY_NAME"]
 
     def run(self, *, container: BorgmaticContainer, **kwargs):
-        container.exec(["borgmatic", "export", "key"], self.env_vars)
+        container.exec(["borgmatic", "export", "key"])
 
 
 class CommandCreateSecrets(Command):