fix(pre-startup): update pre_startup get_config for test, production and local usage

This commit is contained in:
gac-x12sa
2025-06-11 12:51:02 +02:00
committed by appel_c
parent 63ee870c89
commit afd6590360

View File

@@ -2,7 +2,9 @@
Pre-startup script for BEC client. This script is executed before the BEC client
is started. It can be used to add additional command line arguments.
"""
import os
import csaxs_bec
from bec_lib.service_config import ServiceConfig
def extend_command_line_args(parser):
"""
@@ -14,8 +16,14 @@ def extend_command_line_args(parser):
return parser
# def get_config() -> ServiceConfig:
# """
# Create and return the service configuration.
# """
# return ServiceConfig(redis={"host": "localhost", "port": 6379})
def get_config() -> ServiceConfig:
"""
Create and return the service configuration.
"""
path = os.path.dirname(csaxs_bec.__file__)
if path.startswith('/data/test/x12sa-test-bec/production'):
return ServiceConfig(redis={"host": "x12sa-bec-001", "port": 6379})
elif path.startswith('/data/test/x12sa-test-bec/test'):
return ServiceConfig(redis={"host": "x12sa-bec-002", "port": 6379})
else:
return ServiceConfig(redis={"host": "localhost", "port": 6379})