Merge pull request #3 from trolldbois/master

Use Environmental variables for redis
pull/7/head
Alexandre Dulaunoy 2019-06-12 15:17:06 +02:00 committed by GitHub
commit b5b7050232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@ import time
import logging
import sys
import argparse
import os
parser = argparse.ArgumentParser(description='Import array of standard Passive DNS cof format into your Passive DNS server')
parser.add_argument('--file', dest='filetoimport', help='JSON file to import')
@ -47,10 +48,15 @@ logger.addHandler(ch)
logger.info("Starting and using FIFO {} from D4 server".format(myqueue))
d4_server = config.get('global', 'd4-server')
r = redis.Redis(host="127.0.0.1",port=6400)
r_d4 = redis.Redis(host=d4_server.split(':')[0], port=d4_server.split(':')[1], db=2)
analyzer_redis_host = os.getenv('D4_ANALYZER_REDIS_HOST', '127.0.0.1')
analyzer_redis_port = int(os.getenv('D4_ANALYZER_REDIS_PORT', 6400))
d4_server, d4_port = config.get('global', 'd4-server').split(':')
host_redis_metadata = os.getenv('D4_REDIS_METADATA_HOST', d4_server)
port_redis_metadata = int(os.getenv('D4_REDIS_METADATA_PORT', d4_port))
r = redis.Redis(host=analyzer_redis_host, port=analyzer_redis_port)
r_d4 = redis.Redis(host=host_redis_metadata, port=port_redis_metadata, db=2)
with open('../etc/records-type.json') as rtypefile:
rtype = json.load(rtypefile)

View File

@ -22,6 +22,7 @@ import configparser
import time
import logging
import sys
import os
config = configparser.RawConfigParser()
config.read('../etc/analyzer.conf')
@ -45,9 +46,15 @@ logger.addHandler(ch)
logger.info("Starting and using FIFO {} from D4 server".format(myqueue))
d4_server = config.get('global', 'd4-server')
r = redis.Redis(host="127.0.0.1",port=6400)
r_d4 = redis.Redis(host=d4_server.split(':')[0], port=d4_server.split(':')[1], db=2)
analyzer_redis_host = os.getenv('D4_ANALYZER_REDIS_HOST', '127.0.0.1')
analyzer_redis_port = int(os.getenv('D4_ANALYZER_REDIS_PORT', 6400))
d4_server, d4_port = config.get('global', 'd4-server').split(':')
host_redis_metadata = os.getenv('D4_REDIS_METADATA_HOST', d4_server)
port_redis_metadata = int(os.getenv('D4_REDIS_METADATA_PORT', d4_port))
r = redis.Redis(host=analyzer_redis_host, port=analyzer_redis_port)
r_d4 = redis.Redis(host=host_redis_metadata, port=port_redis_metadata, db=2)
with open('../etc/records-type.json') as rtypefile: