Skip to content

Commit f1050a1

Browse files
committed
add module decorator and app_setting
1 parent 5d277a9 commit f1050a1

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

services/docker-compose.devel.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ services:
128128
WEBSERVER_LOGLEVEL: DEBUG
129129
WEBSERVER_PROFILING: ${WEBSERVER_PROFILING}
130130
WEBSERVER_REMOTE_DEBUGGING_PORT: 3000
131+
WEBSERVER_FUNCTIONS: ${WEBSERVER_FUNCTIONS}
131132

132133

133134
wb-api-server:

services/docker-compose.local.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ services:
136136
webserver:
137137
environment: &webserver_environment_local
138138
<<: *common_environment
139+
WEBSERVER_FUNCTIONS: ${WEBSERVER_FUNCTIONS}
139140
ports:
140141
- "8080"
141142
- "3001:3000"

services/web/server/src/simcore_service_webserver/application_settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
105105
bool, Field(description="Enables credit computation features.")
106106
] = False
107107

108+
WEBSERVER_FUNCTIONS: Annotated[
109+
bool,
110+
Field(
111+
validation_alias=AliasChoices("WEBSERVER_FUNCTIONS"),
112+
json_schema_extra={_X_DEV_FEATURE_FLAG: True},
113+
),
114+
] = False
115+
108116
WEBSERVER_LOGLEVEL: Annotated[
109117
LogLevel,
110118
Field(

services/web/server/src/simcore_service_webserver/functions/_controller_rpc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from aiohttp import web
2-
from fastapi import FastAPI
32
from models_library.api_schemas_webserver import WEBSERVER_RPC_NAMESPACE
43
from servicelib.rabbitmq import RPCRouter
54

@@ -12,7 +11,7 @@
1211

1312

1413
@router.expose()
15-
async def ping(app: FastAPI) -> str:
14+
async def ping(app: web.Application) -> str:
1615
assert app
1716
return "pong from webserver"
1817

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import logging
2+
13
from aiohttp import web
4+
from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup
25

36
from . import _controller_rpc
47

8+
_logger = logging.getLogger(__name__)
9+
510

11+
@app_module_setup(
12+
__name__,
13+
ModuleCategory.ADDON,
14+
settings_name="WEBSERVER_FUNCTIONS",
15+
logger=_logger,
16+
)
617
def setup_functions(app: web.Application):
718
app.on_startup.append(_controller_rpc.register_rpc_routes_on_startup)

0 commit comments

Comments
 (0)