Make crontab configurable

This commit is contained in:
Einar Forselv
2019-12-08 06:38:56 +01:00
parent 1e21ff422f
commit ae835f30d3
6 changed files with 99 additions and 3 deletions

View File

@@ -2,12 +2,17 @@ import os
class Config:
default_backup_command = "source /env.sh && rcb backup > /proc/1/fd/1"
default_crontab_schedule = "0 2 * * *"
"""Bag for config values"""
def __init__(self, check=True):
# Mandatory values
self.repository = os.environ.get('RESTIC_REPOSITORY')
self.password = os.environ.get('RESTIC_REPOSITORY')
self.docker_base_url = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock"
self.cron_schedule = os.environ.get('CRON_SCHEDULE') or self.default_crontab_schedule
self.cron_command = os.environ.get('CRON_COMMAND') or self.default_backup_command
# Log
self.log_level = os.environ.get('LOG_LEVEL')