Skip to content

Adds REDIS_URL support and updates the docs#43

Merged
jonakoudijs merged 4 commits intosteamcmd:masterfrom
sxalexander:pr-allow-redis-url
Feb 25, 2023
Merged

Adds REDIS_URL support and updates the docs#43
jonakoudijs merged 4 commits intosteamcmd:masterfrom
sxalexander:pr-allow-redis-url

Conversation

@sxalexander
Copy link
Copy Markdown
Contributor

This is a PR for issue #42 which adds REDIS_URL as a way to pass a redis connection string.

@jonakoudijs jonakoudijs added the enhancement New feature or request label Feb 25, 2023
@jonakoudijs jonakoudijs self-assigned this Feb 25, 2023
@jonakoudijs
Copy link
Copy Markdown
Member

The PR is all good. The lint check however fails because black has not been ran. This small cli is an opinionated syntax formatter. If you run the cli (see README) and commit the changes I will merge your PR and create a new version release.

These are the changes:

diff --git a/src/functions.py b/src/functions.py
index 34c7d4d..c6d0e18 100644
--- a/src/functions.py
+++ b/src/functions.py
@@ -83,6 +83,7 @@ def cache_write(app_id, data):
     # return failed status
     return False
 
+
 def redis_connection():
     """
     Parse redis config and connect.
@@ -101,6 +102,7 @@ def redis_connection():
     # return connection
     return rds
 
+
 def redis_read(app_id):
     """
     Read app info from Redis cache.
@@ -143,7 +145,7 @@ def redis_write(app_id, data):
     """
 
     rds = redis_connection()
-    
+
     # write cache data and set ttl
     try:
         # convert dict to json
diff --git a/src/main.py b/src/main.py
index 572f27c..5eb6faf 100644
--- a/src/main.py
+++ b/src/main.py
@@ -18,7 +18,7 @@ load_dotenv()
 # initialise app
 app = FastAPI()
 
-origins = [x for x in os.environ.get("ALLOWED_HOSTS", "http://localhost").split(',')]
+origins = [x for x in os.environ.get("ALLOWED_HOSTS", "http://localhost").split(",")]
 
 app.add_middleware(
     CORSMiddleware,
@@ -28,6 +28,7 @@ app.add_middleware(                                                                                                        
     allow_headers=["*"],                                                                                                                    
 )                                                                                                                                           
                                                                                                                                             
+                                                                                                                                            
 # include "pretty" for backwards compatibility                                                                                              
 class PrettyJSONResponse(Response):                                                                                                         
     media_type = "application/json"

@sxalexander
Copy link
Copy Markdown
Contributor Author

Just updated ! 👍🏾

@jonakoudijs
Copy link
Copy Markdown
Member

Perfect! Our comments crossed, I will merge the PR and update the issue if the new version has been deployed.

@jonakoudijs jonakoudijs merged commit b38ecdf into steamcmd:master Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants