diff --git a/.copier-answers.yml b/.copier-answers.yml index 3dd46f1..8c4bd24 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -2,7 +2,7 @@ # It is needed to track the repo template version, and editing may break things. # This file will be overwritten by copier on template updates. -_commit: v1.0.0 +_commit: v1.0.3-1-g7cb3be0 _src_path: https://github.com/bec-project/plugin_copier_template.git make_commit: false project_name: csaxs_bec diff --git a/csaxs_bec/bec_ipython_client/startup/pre_startup.py b/csaxs_bec/bec_ipython_client/startup/pre_startup.py index c9e6274..4ba6343 100644 --- a/csaxs_bec/bec_ipython_client/startup/pre_startup.py +++ b/csaxs_bec/bec_ipython_client/startup/pre_startup.py @@ -1,8 +1,14 @@ """ 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 + +from bec_lib.service_config import ServiceConfig + +import csaxs_bec + def extend_command_line_args(parser): """ @@ -14,8 +20,13 @@ 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 ServiceConfig for the plugin repository + """ + deployment_path = os.path.dirname(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})