mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-09-28 06:35:24 +00:00
Split up modules
This commit is contained in:
@@ -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)
|
||||
|
19
restic_volume_backup/config.py
Normal file
19
restic_volume_backup/config.py
Normal file
@@ -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")
|
Reference in New Issue
Block a user