Skip to content

Commit

Permalink
Merge pull request #38 from bento-platform/chore/bento-lib-10-1-0
Browse files Browse the repository at this point in the history
chore: update bento_lib to 10.1.0 and move service vars to config
  • Loading branch information
davidlougheed authored Nov 27, 2023
2 parents fd86297 + 09b459e commit 075992f
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 210 deletions.
10 changes: 7 additions & 3 deletions bento_drop_box_service/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json

from bento_lib.logging import LogLevelLiteral
from fastapi import Depends
from functools import lru_cache
from pydantic.fields import FieldInfo
Expand Down Expand Up @@ -27,18 +28,21 @@ class Config(BaseSettings):
bento_container_local: bool = False

service_id: str = str(":".join(list(SERVICE_TYPE.values())[:2]))
service_data_source: Literal["local"] = "local"
service_data: str = "data/"
service_name: str = "Bento Drop Box Service"
service_description: str = "Drop box service for a Bento platform node."
service_contact_url: str = "mailto:[email protected]"
service_url: str = "http://127.0.0.1:5000" # base URL to construct object URIs from

service_data: str = "data/"
service_data_source: Literal["local"] = "local"
traversal_limit: int = 16

bento_authz_service_url: str # Bento authorization service base URL
authz_enabled: bool = True

cors_origins: tuple[str, ...]

log_level: Literal["debug", "info", "warning", "error"] = "debug"
log_level: LogLevelLiteral = "debug"

# Make Config instances hashable + immutable
model_config = SettingsConfigDict(frozen=True)
Expand Down
2 changes: 0 additions & 2 deletions bento_drop_box_service/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

__all__ = [
"BENTO_SERVICE_KIND",
"SERVICE_NAME",
"SERVICE_TYPE",
]

BENTO_SERVICE_KIND = "drop-box"
SERVICE_NAME = "Bento Drop Box Service"
SERVICE_TYPE: GA4GHServiceType = {
"group": "ca.c3g.bento",
"artifact": BENTO_SERVICE_KIND,
Expand Down
8 changes: 4 additions & 4 deletions bento_drop_box_service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from . import __version__
from .authz import authz_middleware
from .backends.dependency import BackendDependency
from .constants import BENTO_SERVICE_KIND, SERVICE_NAME, SERVICE_TYPE
from .constants import BENTO_SERVICE_KIND, SERVICE_TYPE
from .config import ConfigDependency
from .logger import LoggerDependency

Expand Down Expand Up @@ -76,11 +76,11 @@ async def service_info(config: ConfigDependency, logger: LoggerDependency) -> Re
# Spec: https://github.com/ga4gh-discovery/ga4gh-service-info
return JSONResponse(await build_service_info({
"id": config.service_id,
"name": SERVICE_NAME,
"name": config.service_name,
"type": SERVICE_TYPE,
"description": "Drop box service for a Bento platform node.",
"description": config.service_description,
"organization": SERVICE_ORGANIZATION_C3G,
"contactUrl": "mailto:[email protected]",
"contactUrl": config.service_contact_url,
"version": __version__,
"bento": {
"serviceKind": BENTO_SERVICE_KIND
Expand Down
Loading

0 comments on commit 075992f

Please sign in to comment.