Option to disable image discovery and do not scan parent directory

This commit is contained in:
grossmj
2022-12-26 12:32:40 +08:00
parent 9a7b3bed25
commit c6e31d98db
5 changed files with 25 additions and 12 deletions

View File

@ -21,6 +21,7 @@ from typing import Callable
from fastapi import FastAPI
from gns3server.controller import Controller
from gns3server.config import Config
from gns3server.compute import MODULES
from gns3server.compute.port_manager import PortManager
from gns3server.utils.http_client import HTTPClient
@ -60,9 +61,10 @@ def create_startup_handler(app: FastAPI) -> Callable:
# computing with server start
from gns3server.compute.qemu import Qemu
# Start the discovering new images on file system 5 seconds after the server has started
# to give it a chance to process API requests
loop.call_later(5, asyncio.create_task, discover_images_on_filesystem(app))
if Config.instance().settings.Server.auto_discover_images is True:
# Start the discovering new images on file system 5 seconds after the server has started
# to give it a chance to process API requests
loop.call_later(5, asyncio.create_task, discover_images_on_filesystem(app))
for module in MODULES:
log.debug(f"Loading module {module.__name__}")