mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 12:34:17 +00:00
py-i2phosts-builder: add config file support
This commit is contained in:
parent
00b98dfc93
commit
e64139d729
@ -3,6 +3,7 @@
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import configobj
|
||||
|
||||
# parse command line options
|
||||
parser = argparse.ArgumentParser(
|
||||
@ -12,6 +13,12 @@ parser.add_argument('-c', '--config', default='/etc/py-i2phosts/builder.conf', d
|
||||
help='config file to use')
|
||||
args = parser.parse_args()
|
||||
|
||||
# read config
|
||||
config = configobj.ConfigObj(args.config_file, file_error=True)
|
||||
if 'include' in config:
|
||||
config_included = configobj.ConfigObj(config['include'])
|
||||
config.merge(config_included)
|
||||
|
||||
# django setup
|
||||
DJANGO_SETTINGS_MODULE = 'settings'
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'
|
||||
|
Loading…
x
Reference in New Issue
Block a user