mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-02-02 01:44:40 +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 os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
import configobj
|
||||||
|
|
||||||
# parse command line options
|
# parse command line options
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@ -12,6 +13,12 @@ parser.add_argument('-c', '--config', default='/etc/py-i2phosts/builder.conf', d
|
|||||||
help='config file to use')
|
help='config file to use')
|
||||||
args = parser.parse_args()
|
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 setup
|
||||||
DJANGO_SETTINGS_MODULE = 'settings'
|
DJANGO_SETTINGS_MODULE = 'settings'
|
||||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'
|
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user