Update lightrag_server.py

This commit is contained in:
Saifeddine ALOUI
2025-01-24 17:04:02 +01:00
committed by GitHub
parent 70423a72ac
commit f30831dc9d

View File

@@ -408,6 +408,13 @@ def parse_args() -> argparse.Namespace:
default=get_env_value("SSL_KEYFILE", None),
help="Path to SSL private key file (required if --ssl is enabled)",
)
parser.add_argument(
'--auto-scan-at-startup',
action='store_true',
default=False,
help='Enable automatic scanning when the program starts'
)
args = parser.parse_args()
display_splash_screen(args)
@@ -800,6 +807,9 @@ def create_app(args):
async def lifespan(app: FastAPI):
"""Lifespan context manager for startup and shutdown events"""
# Startup logic
# Now only if this option is active, we can scan. This is better for big databases where there are hundreds of
# files. Makes the startup faster
if args.auto_scan_at_startup:
try:
new_files = doc_manager.scan_directory()
for file_path in new_files: