Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mapping Provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
Next Generation Map
Mapping Provider
Merge requests
!1
Feature/get graph data from gap
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/get graph data from gap
feature/get-graph-data-from-gap
into
master
Overview
0
Commits
7
Pipelines
0
Changes
3
Merged
Neda Moeini
requested to merge
feature/get-graph-data-from-gap
into
master
2 months ago
Overview
0
Commits
7
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Viewing commit
320c9f0c
Prev
Next
Show latest version
3 files
+
28
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
320c9f0c
Restructure FAST API app and load configuration into app
· 320c9f0c
Neda Moeini
authored
1 month ago
mapping_provider/__init__.py
+
8
−
8
Options
"""
Initializes the FastAPI application.
"""
import
os
"""
Create a FastAPI application for the mapping provider.
"""
from
fastapi
import
FastAPI
from
mapping_provider
import
config
from
mapping_provider.api.common
import
router
as
version_router
from
mapping_provider.api.network_graph
import
router
as
graph_router
def
create_app
()
->
FastAPI
:
"""
Create a FastAPI application.
"""
@@ -14,9 +12,11 @@ def create_app() -> FastAPI:
description
=
"
Mapping provider endpoints for GÉANT maps
"
,
)
config_file
=
os
.
environ
.
get
(
"
CONFIG_FILE_NAME
"
,
"
config.json
"
)
with
config_file
.
open
()
as
f
:
app
.
state
.
config
=
config
.
load
(
f
)
# Force configuration to be loaded at startup to avoid issues with missing config
from
mapping_provider.dependencies
import
load_config
_
=
load_config
(
)
app
.
include_router
(
version_router
)
return
app
app
.
include_router
(
graph_router
)
return
app
\ No newline at end of file
Loading