添加环境变量判断

This commit is contained in:
pengtao 2019-07-16 16:32:28 +08:00
parent c5e480fc02
commit 05343baaba
2 changed files with 12 additions and 4 deletions

View File

@ -111,7 +111,7 @@ class DispatchHandler(tornado.web.RequestHandler):
self.write({'errcode': 1, "errmsg": 'get adid failed!'})
if adid:
key = f"{adid}::num"
key = f"ad::{adid}::num"
my_redis.incr(key)
self.write({'errcode': 0, "errmsg": '', "message": f"{adid} incr success!"})

View File

@ -1,10 +1,18 @@
# -*- coding: utf-8 -*-
import os
expire_time = 7200
ad_env = os.getenv('ad_env')
ad_mysql_pwd = os.getenv('adpwd')
redis_company_config = {'host': '10.10.4.8', 'port': 6379, 'db': 1, 'passwd': 'crs-9ltb97ds:i33dkxshh'}
mysql_promotion_config = {'user': 'ad', 'pswd': ad_mysql_pwd, 'host': '10.10.3.5', 'db': 'ad'}
if ad_env == 'prod':
redis_company_config = {'host': '10.10.4.8', 'port': 6379, 'db': 1, 'passwd': 'crs-9ltb97ds:i33dkxshh'}
mysql_promotion_config = {'user': 'ad', 'pswd': ad_mysql_pwd, 'host': '10.10.3.5', 'db': 'ad'}
elif ad_env == 'dev':
redis_company_config = {'host': '192.168.100.20', 'port': 6379, 'db': 2, 'passwd': ''}
mysql_promotion_config = {'user': 'miles', 'pswd': 'aspect', 'host': '192.168.100.30', 'db': 'test'}
expire_time = 7200
ad_list_interface_port = 5014
BEGIN = '1999-01-01'
END = '3000-01-01'