-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from bento-platform/refact/deps-service-info-c…
…onfig-override refact: reconfigure app/config setup + update dependencies
- Loading branch information
Showing
14 changed files
with
599 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
from bento_lib.service_info import GA4GHServiceType | ||
from bento_service_registry import __version__ | ||
from bento_lib.service_info.types import GA4GHServiceType | ||
|
||
__all__ = [ | ||
"BENTO_SERVICE_KIND", | ||
"SERVICE_ARTIFACT", | ||
"SERVICE_TYPE", | ||
"SERVICE_NAME", | ||
] | ||
|
||
BENTO_SERVICE_KIND: str = "service-registry" | ||
SERVICE_ARTIFACT: str = "service-registry" | ||
|
||
# For exact implementations, this should be org.ga4gh/service-registry/1.0.0. | ||
# In our case, most of our services diverge or will at some point, so use ca.c3g.bento as the group. | ||
SERVICE_TYPE: GA4GHServiceType = { | ||
"group": "ca.c3g.bento", | ||
"artifact": SERVICE_ARTIFACT, | ||
"version": __version__, | ||
"artifact": "service-registry", | ||
"version": "1.0.0", | ||
} | ||
SERVICE_NAME: str = "Bento Service Registry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
from bento_lib.service_info import SERVICE_ORGANIZATION_C3G, GA4GHServiceInfo, build_service_info | ||
from bento_lib.service_info.helpers import build_service_info_from_pydantic_config | ||
from bento_lib.service_info.types import GA4GHServiceInfo | ||
from bento_service_registry import __version__ | ||
from fastapi import Depends | ||
from typing import Annotated | ||
|
||
from .bento_services_json import BentoServicesByKindDependency | ||
from .config import ConfigDependency | ||
from .constants import BENTO_SERVICE_KIND, SERVICE_NAME, SERVICE_TYPE | ||
from .constants import BENTO_SERVICE_KIND, SERVICE_TYPE | ||
from .logger import LoggerDependency | ||
from .utils import get_service_url | ||
|
||
|
||
__all__ = [ | ||
|
@@ -16,25 +15,14 @@ | |
] | ||
|
||
|
||
async def get_service_info( | ||
bento_services_by_kind: BentoServicesByKindDependency, | ||
config: ConfigDependency, | ||
logger: LoggerDependency, | ||
) -> GA4GHServiceInfo: | ||
return await build_service_info({ | ||
"id": config.service_id, | ||
"name": SERVICE_NAME, # TODO: Should be globally unique? | ||
"type": SERVICE_TYPE, | ||
"description": "Service registry for a Bento platform node.", | ||
"organization": SERVICE_ORGANIZATION_C3G, | ||
"contactUrl": "mailto:[email protected]", | ||
"version": __version__, | ||
"url": get_service_url(bento_services_by_kind, BENTO_SERVICE_KIND), | ||
"environment": "prod", | ||
"bento": { | ||
"serviceKind": BENTO_SERVICE_KIND, | ||
}, | ||
}, debug=config.bento_debug, local=config.bento_container_local, logger=logger) | ||
async def get_service_info(config: ConfigDependency, logger: LoggerDependency) -> GA4GHServiceInfo: | ||
return await build_service_info_from_pydantic_config( | ||
config, | ||
logger, | ||
{"serviceKind": BENTO_SERVICE_KIND}, | ||
SERVICE_TYPE, | ||
__version__, | ||
) | ||
|
||
|
||
ServiceInfoDependency = Annotated[GA4GHServiceInfo, Depends(get_service_info)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.