Added ssl support
Browse files
lightrag/api/lightrag_server.py
CHANGED
@@ -262,7 +262,16 @@ def create_app(args):
|
|
262 |
raise Exception("embedding binding not supported")
|
263 |
|
264 |
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
# Setup logging
|
267 |
logging.basicConfig(
|
268 |
format="%(levelname)s:%(message)s", level=getattr(logging, args.log_level)
|
@@ -577,7 +586,17 @@ def main():
|
|
577 |
import uvicorn
|
578 |
|
579 |
app = create_app(args)
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
|
582 |
|
583 |
if __name__ == "__main__":
|
|
|
262 |
raise Exception("embedding binding not supported")
|
263 |
|
264 |
|
265 |
+
# Add SSL validation
|
266 |
+
if args.ssl:
|
267 |
+
if not args.ssl_certfile or not args.ssl_keyfile:
|
268 |
+
raise Exception("SSL certificate and key files must be provided when SSL is enabled")
|
269 |
+
if not os.path.exists(args.ssl_certfile):
|
270 |
+
raise Exception(f"SSL certificate file not found: {args.ssl_certfile}")
|
271 |
+
if not os.path.exists(args.ssl_keyfile):
|
272 |
+
raise Exception(f"SSL key file not found: {args.ssl_keyfile}")
|
273 |
+
|
274 |
+
|
275 |
# Setup logging
|
276 |
logging.basicConfig(
|
277 |
format="%(levelname)s:%(message)s", level=getattr(logging, args.log_level)
|
|
|
586 |
import uvicorn
|
587 |
|
588 |
app = create_app(args)
|
589 |
+
uvicorn_config = {
|
590 |
+
"app": app,
|
591 |
+
"host": args.host,
|
592 |
+
"port": args.port,
|
593 |
+
}
|
594 |
+
if args.ssl:
|
595 |
+
uvicorn_config.update({
|
596 |
+
"ssl_certfile": args.ssl_certfile,
|
597 |
+
"ssl_keyfile": args.ssl_keyfile,
|
598 |
+
})
|
599 |
+
uvicorn.run(**uvicorn_config)
|
600 |
|
601 |
|
602 |
if __name__ == "__main__":
|