Make config check skippable for tests

This commit is contained in:
Einar Forselv 2019-04-16 18:21:42 +02:00
parent 21843c8b7f
commit 9d3d87d9d5
1 changed files with 4 additions and 2 deletions

View File

@ -2,11 +2,13 @@ import os
class Config: class Config:
def __init__(self): def __init__(self, check=True):
self.repository = os.environ['RESTIC_REPOSITORY'] self.repository = os.environ['RESTIC_REPOSITORY']
self.password = os.environ['RESTIC_PASSWORD'] self.password = os.environ['RESTIC_PASSWORD']
self.docker_base_url = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock" self.docker_base_url = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock"
self.check()
if check:
self.check()
def check(self): def check(self):
if not self.repository: if not self.repository: