Unify configuration requirements
This commit is contained in:
parent
276e0d0cd4
commit
cd67b0934e
2
lacre.py
2
lacre.py
|
@ -37,7 +37,7 @@ LOG = logging.getLogger('lacre.py')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with time_logger('Message delivery', LOG):
|
with time_logger('Message delivery', LOG):
|
||||||
missing_params = conf.validate_config(additional=conf.SCRIPT_REQUIRED)
|
missing_params = conf.validate_config()
|
||||||
config_file = conf.config_source()
|
config_file = conf.config_source()
|
||||||
|
|
||||||
if missing_params:
|
if missing_params:
|
||||||
|
|
|
@ -18,7 +18,10 @@ lacre.init_logging(conf.get_item('logging', 'config'))
|
||||||
import lacre.repositories as repo
|
import lacre.repositories as repo
|
||||||
import lacre.dbschema as db
|
import lacre.dbschema as db
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
if __name__ == '__main__':
|
||||||
|
LOG = logging.getLogger('lacre.admin')
|
||||||
|
else:
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _no_database():
|
def _no_database():
|
||||||
|
@ -86,7 +89,10 @@ def sub_import(args):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
conf.validate_config(additional=conf.SCRIPT_REQUIRED)
|
missing = conf.validate_config()
|
||||||
|
if missing:
|
||||||
|
LOG.error('Missing configuration parameters: %s', missing)
|
||||||
|
sys.exit(lacre.EX_CONFIG)
|
||||||
|
|
||||||
general_conf = conf.config_source()
|
general_conf = conf.config_source()
|
||||||
log_conf = conf.get_item('logging', 'config')
|
log_conf = conf.get_item('logging', 'config')
|
||||||
|
|
|
@ -21,16 +21,12 @@ MANDATORY_CONFIG_ITEMS = [("relay", "host"),
|
||||||
("relay", "port"),
|
("relay", "port"),
|
||||||
("daemon", "host"),
|
("daemon", "host"),
|
||||||
("daemon", "port"),
|
("daemon", "port"),
|
||||||
("gpg", "keyhome")]
|
("gpg", "keyhome"),
|
||||||
|
('database', 'enabled'),
|
||||||
|
('database', 'url'),
|
||||||
|
('database', 'pooling_mode')]
|
||||||
|
|
||||||
SCRIPT_REQUIRED = [('database', 'enabled'),
|
CRON_REQUIRED = [('cron', 'mail_templates')]
|
||||||
('database', 'url'),
|
|
||||||
('database', 'pooling_mode')]
|
|
||||||
|
|
||||||
CRON_REQUIRED = [('database', 'enabled'),
|
|
||||||
('database', 'url'),
|
|
||||||
('database', 'pooling_mode'),
|
|
||||||
('cron', 'mail_templates')]
|
|
||||||
|
|
||||||
# Global dict to keep configuration parameters. It's hidden behind several
|
# Global dict to keep configuration parameters. It's hidden behind several
|
||||||
# utility functions to make it easy to replace it with ConfigParser object in
|
# utility functions to make it easy to replace it with ConfigParser object in
|
||||||
|
|
Loading…
Reference in New Issue