This repository has been archived on 2022-01-29. You can view files and clone it, but cannot push or open issues or pull requests.
saturn/saturn/__main__.py

45 lines
1 KiB
Python

import argparse
import configparser
import logging
import locale
## dev imports
from pprint import pp
import sys
from pathlib import Path
from datetime import date
import caldav
from .server import create_app
from .calendar import get_davclient
parser = argparse.ArgumentParser(description='Web-based CalDav client')
parser.add_argument('-c', '--config', type=Path, default='config.ini',
help='Configuration file path')
args = parser.parse_args()
config = configparser.ConfigParser()
config.read(args.config)
locale.setlocale(locale.LC_ALL, config.get('locale', 'locale', fallback=None))
logging.basicConfig(level=config.get('logging', 'level', fallback='WARN'))
log = logging.getLogger('saturn')
log.info('Starting saturn')
davclient = get_davclient(config['caldav'])
app = create_app(
davclient,
)
if __name__ == '__main__':
app.run(
host=config.get('server', 'host', fallback=None),
port=config.get('server', 'port', fallback=None),
debug=config.get('server', 'debug', fallback=None),
)