34 lines
965 B
Python
34 lines
965 B
Python
|
# coding: utf-8
|
||
|
|
||
|
import sys
|
||
|
import os
|
||
|
import ConfigParser
|
||
|
|
||
|
__config_file__ = os.getenv('CLOUD_CONFIG_FILE', '/etc/sws/cloud/core.ini')
|
||
|
|
||
|
# setting file read
|
||
|
config = ConfigParser.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('config file not found: %s' % __config_file__)
|