Skip to content

Commit 753d8db

Browse files
feat: Make UI accessible behind proxy (#3428)
* feat: Make UI runnable behind proxy Signed-off-by: Hai Nguyen <[email protected]> * chore: root_path is optional for type hint Signed-off-by: Hai Nguyen <[email protected]> Signed-off-by: Hai Nguyen <[email protected]>
1 parent 01ab462 commit 753d8db

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

sdk/python/feast/cli.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,24 @@ def version():
151151
"--registry_ttl_sec",
152152
"-r",
153153
help="Number of seconds after which the registry is refreshed",
154-
type=int,
154+
type=click.INT,
155155
default=5,
156156
show_default=True,
157157
)
158+
@click.option(
159+
"--root_path",
160+
help="Provide root path to make the UI working behind proxy",
161+
type=click.STRING,
162+
default="",
163+
)
158164
@click.pass_context
159-
def ui(ctx: click.Context, host: str, port: int, registry_ttl_sec: int):
165+
def ui(
166+
ctx: click.Context,
167+
host: str,
168+
port: int,
169+
registry_ttl_sec: int,
170+
root_path: Optional[str] = "",
171+
):
160172
"""
161173
Shows the Feast UI over the current directory
162174
"""
@@ -170,6 +182,7 @@ def ui(ctx: click.Context, host: str, port: int, registry_ttl_sec: int):
170182
port=port,
171183
get_registry_dump=registry_dump,
172184
registry_ttl_sec=registry_ttl_sec,
185+
root_path=root_path,
173186
)
174187

175188

sdk/python/feast/feature_store.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2319,7 +2319,12 @@ def get_feature_server_endpoint(self) -> Optional[str]:
23192319

23202320
@log_exceptions_and_usage
23212321
def serve_ui(
2322-
self, host: str, port: int, get_registry_dump: Callable, registry_ttl_sec: int
2322+
self,
2323+
host: str,
2324+
port: int,
2325+
get_registry_dump: Callable,
2326+
registry_ttl_sec: int,
2327+
root_path: Optional[str] = "",
23232328
) -> None:
23242329
"""Start the UI server locally"""
23252330
if flags_helper.is_test():
@@ -2335,6 +2340,7 @@ def serve_ui(
23352340
get_registry_dump=get_registry_dump,
23362341
project_id=self.config.project,
23372342
registry_ttl_sec=registry_ttl_sec,
2343+
root_path=root_path,
23382344
)
23392345

23402346
@log_exceptions_and_usage

sdk/python/feast/ui_server.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ def start_server(
101101
get_registry_dump: Callable,
102102
project_id: str,
103103
registry_ttl_sec: int,
104+
root_path: Optional[str] = "",
104105
):
105-
app = get_app(store, get_registry_dump, project_id, registry_ttl_sec, host, port)
106-
uvicorn.run(app, host=host, port=port)
106+
app = get_app(
107+
store,
108+
get_registry_dump,
109+
project_id,
110+
registry_ttl_sec,
111+
host,
112+
port,
113+
)
114+
uvicorn.run(app, host=host, port=port, root_path=root_path)

0 commit comments

Comments
 (0)