steamcmd / api

Read-only API interface for steamcmd app_info
https://www.steamcmd.net
MIT License
59 stars 8 forks source link

Adds REDIS_URL support and updates the docs #43

Closed sxalexander closed 1 year ago

sxalexander commented 1 year ago

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

jonakoudijs commented 1 year ago

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 commented 1 year ago

Just updated ! 👍🏾

jonakoudijs commented 1 year ago

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