Fix config option to disable built-in templates.

This commit is contained in:
grossmj committed 2022-06-21 17:17:44 +02:00
1 parent d8b928f1c1
commit 410f062721
3 files changed
+18 -2

No files matched your search

+4 -2
View File
@@ -23,6 +23,7 @@ from fastapi.encoders import jsonable_encoder
from typing import List
from gns3server import schemas
from gns3server.config import Config
import gns3server.db.models as models
from gns3server.db.repositories.templates import TemplatesRepository
from gns3server.controller.controller_error import (
@@ -174,8 +175,9 @@ class TemplatesService:
db_templates = await self._templates_repo.get_templates()
for db_template in db_templates:
templates.append(db_template.asjson())
for builtin_template in BUILTIN_TEMPLATES:
templates.append(jsonable_encoder(builtin_template))
if Config.instance().settings.Server.enable_builtin_templates:
for builtin_template in BUILTIN_TEMPLATES:
templates.append(jsonable_encoder(builtin_template))
return templates
async def _find_image(self, image_path: str):