Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Jan 2, 2025
1 parent bc0cc36 commit fcd2d97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/gene/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
from gene.database.database import (
AWS_ENV_VAR_NAME,
VALID_AWS_ENV_NAMES,
AwsEnvName,
create_db,
)
from gene.query import InvalidParameterException, QueryHandler
from gene.schemas import (
NormalizeService,
SearchService,
ServiceEnvironment,
ServiceInfo,
ServiceOrganization,
ServiceType,
Expand Down Expand Up @@ -175,16 +175,17 @@ def normalize_unmerged(
)
def service_info() -> ServiceInfo:
"""Provide service info per GA4GH Service Info spec
:return: conformant service info description
"""
if not os.environ.get(AWS_ENV_VAR_NAME):
env = ServiceEnvironment.DEV
env = None
else:
raw_env_var = os.environ[AWS_ENV_VAR_NAME]
if raw_env_var not in VALID_AWS_ENV_NAMES:
env = ServiceEnvironment.DEV
# elif raw_env_var == AW
# TODO check what env var is used for nonprod box
env = None
else:
env = AwsEnvName(raw_env_var)

return ServiceInfo(
organization=ServiceOrganization(), type=ServiceType(), environment=env
Expand Down
12 changes: 2 additions & 10 deletions src/gene/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)

from gene import __version__
from gene.database.database import AwsEnvName

CURIE_REGEX = r"^\w[^:]*:.+$"

Expand Down Expand Up @@ -746,15 +747,6 @@ class ServiceType(BaseModel):
version: Literal[__version__] = __version__


class ServiceEnvironment(str, Enum):
"""Define current environment for service_info field"""

DEV = "dev"
PROD = "prod"
TEST = "test"
STAGING = "staging"


class ServiceInfo(BaseModel):
"""Define response structure for GA4GH /service_info endpoint."""

Expand All @@ -777,5 +769,5 @@ class ServiceInfo(BaseModel):
"2024-03-04T00:00:00.000000+00:00"
)
updatedAt: str | None = None # noqa: N815
environment: ServiceEnvironment
environment: AwsEnvName | None = None
version: Literal[__version__] = __version__

0 comments on commit fcd2d97

Please sign in to comment.