Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow skynet to listen on specified IP addresses #133

Open
jmcclelland opened this issue Jan 2, 2025 · 4 comments
Open

allow skynet to listen on specified IP addresses #133

jmcclelland opened this issue Jan 2, 2025 · 4 comments

Comments

@jmcclelland
Copy link

It would be convenient if we could pass an environment variable like HOST=1.2.3.4 to control what IP address skynet binds to.

It would require a small change to skynet/utils.py:

--- a/skynet/utils.py
+++ b/skynet/utils.py
@@ -1,3 +1,4 @@
+import os
 import uvicorn
 from fastapi import APIRouter, Depends, FastAPI
 from fastapi.middleware.cors import CORSMiddleware
@@ -34,9 +35,10 @@ def get_router() -> APIRouter:
 
 
 async def create_webserver(app, port):
+    host = os.environ.get('HOST', '0.0.0.0')
     server_config = uvicorn.Config(
         app,
-        host='0.0.0.0',
+        host=host,
@saghul
Copy link
Member

saghul commented Jan 2, 2025

No objection as long as the current default remains!

@rpurdel
Copy link
Collaborator

rpurdel commented Jan 8, 2025

maybe define another variable as $HOST is kind of taken ;)

@saghul
Copy link
Member

saghul commented Jan 8, 2025

LISTEN_IP?

@jmcclelland
Copy link
Author

Good point. LISTEN_IP works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants