from rediscluster import RedisCluster import os class RedisClusterSetting(): def get_redis_cluster_info(): if os.environ.get('REDIS_CLUSTER_HOST') == None: os.environ['REDIS_CLUSTER_HOST'] = 'redis_1,redis_2,redis_3' if os.environ.get('REDIS_CLUSTER_PORT') == None: os.environ['REDIS_CLUSTER_PORT'] = '6379,6379,6379' if os.environ.get('REDIS_CLUSTER_PASSWORD') == None: os.environ['REDIS_CLUSTER_P..
import os import redis import time class RedisSetting(): def get_redis_info(): if os.environ.get('REDIS_HOST') == None: os.environ['REDIS_HOST'] = 'redis' if os.environ.get('REDIS_PORT') == None: os.environ['REDIS_PORT'] = '6379' if os.environ.get('REDIS_PASSWORD') == None: os.environ['REDIS_PASSWORD'] = 'password' env_dict = {} for key, value in os.environ.items(): env_dict.setdefault(key, valu..
import os import pprint env_dict = {} if os.environ.get('redis_host') == None: os.environ['redis_host'] = 'redis' if os.environ.get('redis_port') == None: os.environ['redis_port'] = '6379' for key, value in os.environ.items(): env_dict.setdefault(key, value) pprint.pprint(env_dict) 실제 나의 환경변수는 아래와 같다.