|
|
@ -13,6 +13,7 @@ DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/web' |
|
|
|
sys.path.insert(1, DJANGO_PROJECT_PATH) |
|
|
|
sys.path.insert(1, DJANGO_PROJECT_PATH) |
|
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE |
|
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE |
|
|
|
from web.postkey.models import i2phost |
|
|
|
from web.postkey.models import i2phost |
|
|
|
|
|
|
|
import configobj |
|
|
|
|
|
|
|
|
|
|
|
# parse command line options |
|
|
|
# parse command line options |
|
|
|
parser = argparse.ArgumentParser( |
|
|
|
parser = argparse.ArgumentParser( |
|
|
@ -20,6 +21,8 @@ parser = argparse.ArgumentParser( |
|
|
|
epilog='Report bugs to http://zzz.i2p/topics/733') |
|
|
|
epilog='Report bugs to http://zzz.i2p/topics/733') |
|
|
|
parser.add_argument('-d', '--debug', action='store_true', |
|
|
|
parser.add_argument('-d', '--debug', action='store_true', |
|
|
|
help='enable debug messages') |
|
|
|
help='enable debug messages') |
|
|
|
|
|
|
|
parser.add_argument('-c', '--config', default='/etc/py-i2phosts/maintainer.conf', dest='config_file', |
|
|
|
|
|
|
|
help='config file to use') |
|
|
|
args = parser.parse_args() |
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
|
|
|
# configure logger |
|
|
|
# configure logger |
|
|
@ -28,6 +31,12 @@ handler = logging.StreamHandler() |
|
|
|
log.addHandler(handler) |
|
|
|
log.addHandler(handler) |
|
|
|
if args.debug: |
|
|
|
if args.debug: |
|
|
|
log.setLevel(logging.DEBUG) |
|
|
|
log.setLevel(logging.DEBUG) |
|
|
|
|
|
|
|
# read config |
|
|
|
|
|
|
|
config = configobj.ConfigObj(args.config_file) |
|
|
|
|
|
|
|
if 'include' in config: |
|
|
|
|
|
|
|
config_included = configobj.ConfigObj(config['include']) |
|
|
|
|
|
|
|
config.merge(config_included) |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
log.setLevel(logging.INFO) |
|
|
|
log.setLevel(logging.INFO) |
|
|
|
|
|
|
|
|
|
|
|