Skip to content

Commit 9f0fd5f

Browse files
committed
feat: modify some of REST and gRPC config name
Signed-off-by: ImMin5 <[email protected]> (cherry picked from commit 93e5adc)
1 parent d0ef990 commit 9f0fd5f

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/spaceone/core/config/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ def get_service():
3737
return _GLOBAL['SERVICE']
3838

3939

40-
def get_extension_apis():
41-
return _GLOBAL.get('EXTENSION_APIS', {})
42-
43-
4440
def get_handler(name):
4541
return _GLOBAL.get('HANDLERS', {}).get(name, {})
4642

src/spaceone/core/config/default_conf.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Service Description
2-
TITLE = ''
3-
DESCRIPTION = ''
4-
CONTACT = {
5-
}
6-
71
# Service Configuration
82
PACKAGE = None
93
SERVICE = None
@@ -18,27 +12,40 @@
1812
# Unit Test Configuration
1913
MOCK_MODE = False
2014

15+
# gRPC Configuration
2116
# gRPC Extension APIs
22-
EXTENSION_APIS = {
17+
GRPC_EXTENSION_APIS = {
2318
'spaceone.core.extension.grpc_health': ['GRPCHealth'],
2419
'spaceone.core.extension.server_info': ['ServerInfo']
2520
}
2621

27-
# Uvicorn Options for Rest Server
28-
UVICORN_OPTIONS = {
29-
'factory': True
22+
# REST Configuration
23+
# REST Application Options
24+
REST_TITLE = ''
25+
REST_DESCRIPTION = ''
26+
REST_CONTACT = {
3027
}
3128

32-
# Rest Middlewares
29+
# REST Middlewares
3330
REST_MIDDLEWARES = []
3431

32+
# REST Extension Routers
3533
REST_EXTENSION_ROUTERS = [
3634
{
3735
'router_path': 'spaceone.core.fastapi.extension.health:router',
3836
'router_options': {}
3937
}
4038
]
4139

40+
# REST Uvicorn Options
41+
UVICORN_OPTIONS = {
42+
'factory': True
43+
}
44+
45+
# # REST External Swagger
46+
# EXTERNAL_SWAGGER = False
47+
# EXTERNAL_SWAGGER_PATH = []
48+
4249
# Handler Configuration
4350
HANDLERS = {
4451
'authentication': [],

src/spaceone/core/fastapi/server.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from spaceone.core.logger import set_logger
99
from spaceone.core.opentelemetry import set_tracer, set_metric
1010
from spaceone.core.extension.server_info import ServerInfoManager
11-
from spaceone.core.fastapi.openapi import add_external_swagger
1211

1312
_LOGGER = logging.getLogger(__name__)
1413

@@ -124,18 +123,17 @@ def _init_fast_api():
124123
server_info = ServerInfoManager()
125124

126125
return FastAPI(
127-
title=global_conf.get('TITLE', 'Document'),
126+
title=global_conf.get('REST_TITLE', 'Document'),
128127
version=server_info.get_version(),
129-
contact=global_conf.get('CONTACT', {}),
130-
description=global_conf.get('DESCRIPTION', ''),
128+
contact=global_conf.get('REST_CONTACT', {}),
129+
description=global_conf.get('REST_DESCRIPTION', ''),
131130
)
132131

133132

134133
def fast_api_app():
135134
app = _init_fast_api()
136135
app = _add_middlewares(app)
137136
app = _include_routers(app)
138-
app = add_external_swagger(app)
139137
return app
140138

141139

src/spaceone/core/pygrpc/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _init_services(server):
5151
server, service_names = _add_services(server, service_names, proto_conf)
5252

5353
# Set Extension Services
54-
proto_conf = config.get_extension_apis()
54+
proto_conf = config.get_global('GRPC_EXTENSION_APIS', {})
5555
server, service_names = _add_services(server, service_names, proto_conf)
5656

5757
return server, service_names

0 commit comments

Comments
 (0)