mirror of
https://github.com/cve-search/cpe-guesser.git
synced 2024-11-24 15:57:22 +00:00
Add external configuration
This commit is contained in:
parent
5b5ecace85
commit
b138364323
4 changed files with 20 additions and 6 deletions
|
@ -1,2 +1,3 @@
|
|||
redis
|
||||
falcon
|
||||
dynaconf
|
||||
|
|
|
@ -10,14 +10,15 @@ import shutil
|
|||
import xml.sax
|
||||
import redis
|
||||
import time
|
||||
from dynaconf import Dynaconf
|
||||
|
||||
# Configuration
|
||||
cpe_path = '../data/official-cpe-dictionary_v2.3.xml'
|
||||
cpe_source = (
|
||||
'https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz'
|
||||
settings = Dynaconf(
|
||||
settings_files=['../config/settings.yaml']
|
||||
)
|
||||
rdb = redis.Redis(host='127.0.0.1', port=6379, db=8)
|
||||
|
||||
cpe_path = settings.cpe.path
|
||||
cpe_source = (settings.cpe.source)
|
||||
rdb = redis.Redis(host=settings.redis.host, port=settings.redis.port, db=8)
|
||||
|
||||
class CPEHandler(xml.sax.ContentHandler):
|
||||
def __init__(self):
|
||||
|
|
|
@ -6,9 +6,13 @@ import sys
|
|||
import falcon
|
||||
from wsgiref.simple_server import make_server
|
||||
import json
|
||||
from dynaconf import Dynaconf
|
||||
|
||||
# Configuration
|
||||
port = 8000
|
||||
settings = Dynaconf(
|
||||
settings_files=['../config/settings.yaml']
|
||||
)
|
||||
port = settings.server.port
|
||||
|
||||
runPath = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.append(os.path.join(runPath, ".."))
|
||||
|
|
8
config/settings.yaml
Normal file
8
config/settings.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
server:
|
||||
port: 8000
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
cpe:
|
||||
path: '../data/official-cpe-dictionary_v2.3.xml'
|
||||
source: 'https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz'
|
Loading…
Reference in a new issue