restic-compose-backup/restic_volume_backup/config.py

17 lines
476 B
Python
Raw Normal View History

2019-04-15 15:25:42 +00:00
import os
class Config:
def __init__(self):
self.repository = os.environ['RESTIC_REPOSITORY']
self.password = os.environ['RESTIC_PASSWORD']
self.docker_base_url = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock"
self.check()
2019-04-15 15:25:42 +00:00
def check(self):
if not self.repository:
2019-04-15 15:25:42 +00:00
raise ValueError("CONTAINER env var not set")
if not self.password:
2019-04-15 15:25:42 +00:00
raise ValueError("PASSWORD env var not set")