22
33from feast .repo_operations import create_feature_store , registry_dump
44
5+ VALID_MODES = ("proto" , "rest" , "rest-external" )
6+
57
68@click .command ()
79@click .option (
5254 show_default = False ,
5355 help = "path to TLS(SSL) certificate public key. You need to pass --key arg as well to start server in TLS mode" ,
5456)
57+ @click .option (
58+ "--mode" ,
59+ "-m" ,
60+ type = click .Choice (VALID_MODES , case_sensitive = False ),
61+ default = "proto" ,
62+ show_default = True ,
63+ help = (
64+ "Data serving mode for the UI. "
65+ "'proto' serves the registry as a protobuf blob (current default). "
66+ "'rest' mounts the REST registry API alongside the UI. "
67+ "'rest-external' proxies to an external REST registry API."
68+ ),
69+ )
70+ @click .option (
71+ "--rest-api-url" ,
72+ type = click .STRING ,
73+ default = "" ,
74+ help = "Base URL of an external REST registry API (required when --mode=rest-external). Example: http://registry-host:6570/api/v1" ,
75+ )
5576@click .pass_context
5677def ui (
5778 ctx : click .Context ,
@@ -61,6 +82,8 @@ def ui(
6182 root_path : str = "" ,
6283 tls_key_path : str = "" ,
6384 tls_cert_path : str = "" ,
85+ mode : str = "proto" ,
86+ rest_api_url : str = "" ,
6487):
6588 """
6689 Shows the Feast UI over the current directory
@@ -69,8 +92,11 @@ def ui(
6992 raise click .BadParameter (
7093 "Please configure --key and --cert args to start the feature server in SSL mode."
7194 )
95+ if mode == "rest-external" and not rest_api_url :
96+ raise click .BadParameter (
97+ "--rest-api-url is required when using --mode=rest-external."
98+ )
7299 store = create_feature_store (ctx )
73- # Pass in the registry_dump method to get around a circular dependency
74100 store .serve_ui (
75101 host = host ,
76102 port = port ,
@@ -79,4 +105,6 @@ def ui(
79105 root_path = root_path ,
80106 tls_key_path = tls_key_path ,
81107 tls_cert_path = tls_cert_path ,
108+ mode = mode ,
109+ rest_api_url = rest_api_url ,
82110 )
0 commit comments