import sys import os from configparser import ConfigParser __config_file__ = os.getenv('CONFIG', '/etc/nativecloud/config.ini') # setting file read config = ConfigParser() if os.path.exists(__config_file__): config.read(__config_file__) if not config.has_section('Application'): sys.exit(1) if not config.has_option('Application', 'DEBUG'): sys.exit(1) if not config.has_option('Application', 'SECRET_KEY'): sys.exit(1) if not config.has_section('Database'): sys.exit(1) if not config.has_option('Database', 'name'): sys.exit(1) if not config.has_option('Database', 'host'): sys.exit(1) if not config.has_option('Database', 'port'): sys.exit(1) if not config.has_option('Database', 'user'): sys.exit(1) if not config.has_option('Database', 'password'): sys.exit(1) else: sys.exit(f'config file not found: {__config_file__}')