diff --git a/restic_volume_backup/backup.py b/restic_volume_backup/cli.py similarity index 68% rename from restic_volume_backup/backup.py rename to restic_volume_backup/cli.py index ad5a89c..791b38a 100644 --- a/restic_volume_backup/backup.py +++ b/restic_volume_backup/cli.py @@ -1,22 +1,5 @@ -import os -import sys -from containers import RunningContainers -import restic - -cmds = ['status', 'backup', 'snapshots', 'check'] - - -class Config: - repository = os.environ['RESTIC_REPOSITORY'] - password = os.environ['RESTIC_PASSWORD'] - - @classmethod - def check(cls): - if not cls.repository: - raise ValueError("CONTAINER env var not set") - - if not cls.password: - raise ValueError("PASSWORD env var not set") +from restic_volume_backup.config import Config +from restic_volume_backup.containers import RunningContainers def main(): @@ -51,8 +34,6 @@ def main(): # for vol in containers.backup_volumes(): # restic.backup_volume(Config.repository, vol) - - if mode == 'snapshots': restic.snapshots(Config.repository) diff --git a/restic_volume_backup/config.py b/restic_volume_backup/config.py new file mode 100644 index 0000000..8883bc1 --- /dev/null +++ b/restic_volume_backup/config.py @@ -0,0 +1,19 @@ +import os +import sys +from containers import RunningContainers +import restic + +cmds = ['status', 'backup', 'snapshots', 'check'] + + +class Config: + repository = os.environ['RESTIC_REPOSITORY'] + password = os.environ['RESTIC_PASSWORD'] + + @classmethod + def check(cls): + if not cls.repository: + raise ValueError("CONTAINER env var not set") + + if not cls.password: + raise ValueError("PASSWORD env var not set")