Skip to content

Commit

Permalink
api root path to config and add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Jan 22, 2024
1 parent 1986e38 commit dffe74e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ragna/deploy/_api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_component(display_name: str) -> Component:
app = FastAPI(
title="ragna",
version=ragna.__version__,
root_path=os.environ.get("RAGNA_API_ROOT_PATH", ""),
root_path=config.api.root_path,
)
app.add_middleware(
CORSMiddleware,
Expand Down
1 change: 1 addition & 0 deletions ragna/deploy/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ApiConfig(ConfigBase):
# FIXME: this needs to be dynamic for the UI url
origins: list[str] = ["http://127.0.0.1:31477"]
database_url: str = "memory"
root_path: str = ""


class UiConfig(ConfigBase):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_js_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@


def test_preformat_basic():
output = preformat("{ This is awesome {{var}} }")
assert output == "{{ This is awesome {var} }}"


def test_preformat_basic_fmt():
output = preformat("{ This is awesome {{var}} }").format(var="test")
assert output == "{ This is awesome test }"

Expand Down

0 comments on commit dffe74e

Please sign in to comment.