Files
aman-sys/aman/config/System.py
2021-09-02 19:35:02 +02:00

24 lines
614 B
Python

#!/usr/bin/env python
import configparser
import sys
from aman.config.Server import Server
class System:
def __init__(self, filepath : str):
config = configparser.ConfigParser()
config.read(filepath)
# search the required sections
serverSectionAvailable = False
for key in config:
if 'SERVER' == key:
serverSectionAvailable = True
if not serverSectionAvailable:
sys.stderr.write('No server-configuration section found!')
sys.exit(-1)
self.Server = Server(config['SERVER'])