Skip to content

Commit

Permalink
conf options fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vasiljevic committed Apr 3, 2024
1 parent e096be7 commit 252981d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions plct_server/cli_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
20 changes: 10 additions & 10 deletions plct_server/content/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "plct-server"
version = "0.1.6"
version = "0.1.7"
description = ""
authors = ["Nebojsa Vasiljevic <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 252981d

Please sign in to comment.