Skip to content

Commit

Permalink
fix API_USE_LOCAL option
Browse files Browse the repository at this point in the history
  • Loading branch information
ngn13 committed Apr 5, 2024
1 parent ad0a57d commit 39ab996
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ password => default
Default API has few different options:
- `API_MONGO`: MongoDB URL
- `API_PASSWORD`: Password for API access
- `API_USE_LOCAL`: Set to any value if you want API to listen only on the local interface (127.0.0.1)
- `API_USE_LOCAL`: Set to 1 if you want API to listen only on the local interface (127.0.0.1)

However you can modify these options and the handler itself by modifying [`api/main.py`](api/main.py).
If you know a bit of python you can easily write your own handler for your specific use case. All the code
Expand Down
2 changes: 1 addition & 1 deletion api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def http_handler(ip, port):
if __name__ == "__main__":
mongo_url = environ["API_MONGO"] if "API_MONGO" in environ else "mongodb://localhost"
password = environ["API_PASSWORD"] if "API_PASSWORD" in environ else "default"
host = "127.0.0.1" if "API_USE_LOCAL" in environ else "0.0.0.0"
host = "127.0.0.1" if "API_USE_LOCAL" in environ and environ["API_USE_LOCAL"] == "1" else "0.0.0.0"
port = 5000

# creating the API
Expand Down

0 comments on commit 39ab996

Please sign in to comment.