File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ REDIS_HOST="your.redis.host.example.com"
101101REDIS_PORT=6379
102102REDIS_PASSWORD="YourRedisP@ssword!"
103103
104+ # OR, if your host provides a [Connection URL](https://redis-py.readthedocs.io/en/stable/#quickly-connecting-to-redis)
105+ REDIS_URL="redis://YourUsername:YourRedisP@ssword!@your.redis.host.example.com:6379"
106+
104107# deta
105108DETA_BASE_NAME="steamcmd"
106109DETA_PROJECT_KEY="YourDet@ProjectKey!"
Original file line number Diff line number Diff line change @@ -90,11 +90,15 @@ def redis_read(app_id):
9090 """
9191
9292 # parse redis config and connect
93- rds = redis .Redis (
94- host = os .environ ["REDIS_HOST" ],
95- port = os .environ ["REDIS_PORT" ],
96- password = os .environ ["REDIS_PASSWORD" ],
97- )
93+ # try connection string, or default to separate REDIS_* env vars
94+ if "REDIS_URL" in os .environ :
95+ rds = redis .Redis .from_url (os .environ ["REDIS_URL" ])
96+ else :
97+ rds = redis .Redis (
98+ host = os .environ ["REDIS_HOST" ],
99+ port = os .environ ["REDIS_PORT" ],
100+ password = os .environ ["REDIS_PASSWORD" ],
101+ )
98102
99103 try :
100104 # get info from cache
You can’t perform that action at this time.
0 commit comments