Commit 5e03c564 authored by arun.uday's avatar arun.uday

redis hostname and db changed to conf file

parent 08aef6a8
...@@ -24,4 +24,10 @@ port = 1883 ...@@ -24,4 +24,10 @@ port = 1883
requests = 60 requests = 60
[encode] [encode]
encode = utf-8 encode = utf-8
\ No newline at end of file
[redis]
host_name = 127.0.0.1
redis_1 = 0
redis_2 = 1
redis_3 = 2
\ No newline at end of file
...@@ -27,5 +27,11 @@ try: ...@@ -27,5 +27,11 @@ try:
# encode # encode
utf_encode = config.get("encode", "encode") utf_encode = config.get("encode", "encode")
# redis
redis_host = config.get("redis", "host_name")
redis_db1 = config.get("redis", "redis_1")
redis_db2 = config.get("redis", "redis_2")
redis_db3 = config.get("redis", "redis_3")
except Exception as e: except Exception as e:
print(e) print(e)
import redis import redis
from scripts.config import applications_config
from scripts.logging.loggers import logger from scripts.logging.loggers import logger
try: try:
# gold seats database on redis # gold seats database on redis
conn_good = redis.Redis('127.0.0.1', db=0) conn_good = redis.Redis(applications_config.redis_host, db=int(applications_config.redis_db1))
conn_maintenance = redis.Redis('127.0.0.1', db=1) conn_maintenance = redis.Redis(applications_config.redis_host, db=int(applications_config.redis_db2))
conn_error = redis.Redis('127.0.0.1', db=2) conn_error = redis.Redis(applications_config.redis_host, db=int(applications_config.redis_db3))
except Exception as e: except Exception as e:
logger.error("Exception occurred: ", e) logger.error("Exception occurred: ", e)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment