mirror of
https://github.com/sileht/bird-lg.git
synced 2024-12-23 04:54:43 +01:00
Merge branch 'feature/config-file-as-argument'
This commit is contained in:
commit
399139256a
6
lg.py
6
lg.py
|
@ -31,6 +31,7 @@ from urllib2 import urlopen
|
|||
from urllib import quote, unquote
|
||||
import json
|
||||
import random
|
||||
import argparse
|
||||
|
||||
from toolbox import mask_is_valid, ipv6_is_valid, ipv4_is_valid, resolve, save_cache_pickle, load_cache_pickle, unescape
|
||||
#from xml.sax.saxutils import escape
|
||||
|
@ -38,9 +39,12 @@ from toolbox import mask_is_valid, ipv6_is_valid, ipv4_is_valid, resolve, save_c
|
|||
|
||||
import pydot
|
||||
from flask import Flask, render_template, jsonify, redirect, session, request, abort, Response, Markup
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', dest='config_file', help='path to config file', default='lg.cfg')
|
||||
args = parser.parse_args()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_pyfile('lg.cfg')
|
||||
app.config.from_pyfile(args.config_file)
|
||||
app.secret_key = app.config["SESSION_KEY"]
|
||||
app.debug = app.config["DEBUG"]
|
||||
|
||||
|
|
|
@ -26,14 +26,19 @@ from logging.handlers import TimedRotatingFileHandler
|
|||
from logging import FileHandler
|
||||
import subprocess
|
||||
from urllib import unquote
|
||||
import argparse
|
||||
|
||||
from bird import BirdSocket
|
||||
|
||||
from flask import Flask, request, abort
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', dest='config_file', help='path to config file', default='lgproxy.cfg')
|
||||
args = parser.parse_args()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.debug = app.config["DEBUG"]
|
||||
app.config.from_pyfile('lgproxy.cfg')
|
||||
app.config.from_pyfile(args.config_file)
|
||||
|
||||
file_handler = TimedRotatingFileHandler(filename=app.config["LOG_FILE"], when="midnight")
|
||||
app.logger.setLevel(getattr(logging, app.config["LOG_LEVEL"].upper()))
|
||||
|
|
Loading…
Reference in a new issue