From 252981d460a55764816175f121b7622c97fa6354 Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Wed, 3 Apr 2024 14:34:40 +0200 Subject: [PATCH] conf options fixes --- plct_server/cli_main.py | 4 ++-- plct_server/content/server.py | 20 ++++++++++---------- pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plct_server/cli_main.py b/plct_server/cli_main.py index 0745697..6ad1705 100644 --- a/plct_server/cli_main.py +++ b/plct_server/cli_main.py @@ -21,8 +21,8 @@ def serve(folders: tuple[str], host: str, port: int, verbose:bool, ai_context:st logger.info(f"folders: {folders}, host: {host}, port: {port}") server.configure( - course_dirs = folders, verbose = verbose, - ai_context_dir = ai_context) + course_urls = folders, verbose = verbose, + ai_ctx_url = ai_context) app = FastAPI() app.include_router(get_ui_router()) diff --git a/plct_server/content/server.py b/plct_server/content/server.py index df506e8..af358f4 100644 --- a/plct_server/content/server.py +++ b/plct_server/content/server.py @@ -26,7 +26,7 @@ class ConfigOptions(BaseSettings): """Options from the configuration file and/or CLI attributes.""" model_config = SettingsConfigDict(env_prefix='plct_') - content_url: str = None + content_url: str | None = None course_paths: Sequence[str] = [] @validator('course_paths', pre=True) @@ -38,9 +38,9 @@ def split_string(cls, v): return l return v - ai_ctx_url: str = None - verbose: bool = None - api_key: str = None + ai_ctx_url: str | None = None + verbose: bool | None = None + api_key: str | None = None class ServerContent: @@ -85,8 +85,8 @@ def get_server_content() -> ServerContent: raise ValueError("Content configuration not initialized.") return _server_content -def configure(*, course_dirs: tuple[str] = None, verbose: bool = None, - ai_context_dir: str = None) -> None: +def configure(*, course_urls: tuple[str] = None, verbose: bool = None, + ai_ctx_url: str = None) -> None: config_file = os.environ.get("PLCT_SERVER_CONFIG_FILE") conf: ConfigOptions = None @@ -130,10 +130,10 @@ def configure(*, course_dirs: tuple[str] = None, verbose: bool = None, logger.info("The environvent variable PLCT_SERVER_CONFIG_FILE is not set.") if conf is None: conf = ConfigOptions() - if course_dirs: - conf.course_urls = course_dirs - if ai_context_dir: - conf.ai_ctx_url = ai_context_dir + if course_urls: + conf.course_urls = course_urls + if ai_ctx_url: + conf.ai_ctx_url = ai_ctx_url if verbose is not None: conf.verbose = verbose if conf.verbose: diff --git a/pyproject.toml b/pyproject.toml index 5956d3a..0d4f11f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "plct-server" -version = "0.1.6" +version = "0.1.7" description = "" authors = ["Nebojsa Vasiljevic "] license = "MIT"