Skip to content

Commit

Permalink
Generate GraphQL schema during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ogenstad committed Dec 13, 2024
1 parent ad0b02a commit 9d74f7c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/infrahub/core/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from infrahub.core.schema.manager import SchemaManager
from infrahub.database import InfrahubDatabase
from infrahub.exceptions import DatabaseError
from infrahub.graphql.manager import GraphQLSchemaManager
from infrahub.log import get_logger
from infrahub.menu.menu import default_menu
from infrahub.menu.utils import create_menu_children
Expand Down Expand Up @@ -178,6 +179,16 @@ async def initialization(db: InfrahubDatabase) -> None:
)
await branch.save(db=db)

default_branch = registry.get_branch_from_registry(branch=registry.default_branch)
schema_branch = registry.schema.get_schema_branch(name=default_branch.name)
gqlm = GraphQLSchemaManager.get_manager_for_branch(branch=default_branch, schema_branch=schema_branch)
gqlm.get_graphql_schema(
include_query=True,
include_mutation=True,
include_subscription=True,
include_types=True,
)

# ---------------------------------------------------
# Load Default Namespace
# ---------------------------------------------------
Expand Down

0 comments on commit 9d74f7c

Please sign in to comment.