buranun/config.py

21 lines
562 B
Python
Raw Permalink Normal View History

2018-04-21 20:09:14 +00:00
import configparser
def load(filename):
"""Populate the config variables"""
2018-06-09 15:59:59 +00:00
global port, ssl, url_prefix, outside_host, outside_port
2018-04-21 20:09:14 +00:00
global site_name
2018-05-10 08:07:49 +00:00
global database_file
2018-04-21 20:09:14 +00:00
config = configparser.ConfigParser()
config.read(filename)
port = int(config['server']['port'])
2018-06-09 15:59:59 +00:00
ssl = {'yes': True, 'no': False}[config['server']['ssl']]
2018-04-21 20:09:14 +00:00
url_prefix = config['server']['url_prefix']
2018-06-09 15:59:59 +00:00
outside_host = config['server']['outside_host']
outside_port = config['server']['outside_port']
2018-04-21 20:09:14 +00:00
site_name = config['site']['name']
2018-05-10 08:07:49 +00:00
database_file = config['files']['database']