wip test template for bec_config.yaml resolution
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
"""
|
||||
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.
|
||||
is started. It can be used to add additional command line arguments.
|
||||
"""
|
||||
|
||||
import os
|
||||
import csaxs_bec
|
||||
|
||||
from bec_lib.service_config import ServiceConfig
|
||||
|
||||
import csaxs_bec
|
||||
|
||||
|
||||
def extend_command_line_args(parser):
|
||||
"""
|
||||
Extend the command line arguments of the BEC client.
|
||||
@@ -20,10 +24,9 @@ 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})
|
||||
deployment_path = os.path.dirname(os.path.dirname(csaxs_bec.__file__))
|
||||
files = os.listdir(deployment_path)
|
||||
if "bec_config.yaml" in files:
|
||||
return ServiceConfig(config_path=os.path.join(deployment_path, "bec_config.yaml"))
|
||||
else:
|
||||
return ServiceConfig(redis={"host": "localhost", "port": 6379})
|
||||
|
||||
Reference in New Issue
Block a user