Skip to content

Commit

Permalink
Add ui single url and default streams url configs
Browse files Browse the repository at this point in the history
  • Loading branch information
polyaxon-ci committed Dec 18, 2024
1 parent f290980 commit ce15b65
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions haupt/haupt/common/options/conf_subscriptions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
conf.subscribe(core.HealthCheckWorkerTimeout)
conf.subscribe(core.SchedulerEnabled)
conf.subscribe(core.UiAdminEnabled)
conf.subscribe(core.UiSingleUrl)
conf.subscribe(core.UiDefaultStreamsUrl)
conf.subscribe(core.UiAssetsVersion)
conf.subscribe(core.UiBaseUrl)
conf.subscribe(core.UiOffline)
Expand Down
28 changes: 28 additions & 0 deletions haupt/haupt/common/options/registry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
UI_OFFLINE = "UI_OFFLINE"
UI_ENABLED = "UI_ENABLED"
UI_IN_SANDBOX = "UI_IN_SANDBOX"
UI_SINGLE_URL = "UI_SINGLE_URL"
UI_DEFAULT_STREAMS_URL = "UI_DEFAULT_STREAMS_URL"

OPTIONS = {
LOGGING,
Expand All @@ -30,6 +32,8 @@
UI_OFFLINE,
UI_ENABLED,
UI_IN_SANDBOX,
UI_SINGLE_URL,
UI_DEFAULT_STREAMS_URL,
}


Expand Down Expand Up @@ -199,3 +203,27 @@ class UiInSandbox(Option):
typing = "bool"
default = False
options = None


class UiSingleUrl(Option):
key = UI_SINGLE_URL
scope = OptionScope.GLOBAL
is_secret = False
is_optional = True
is_list = False
store = OptionStores.SETTINGS
typing = "bool"
default = False
options = None


class UiDefaultStreamsUrl(Option):
key = UI_DEFAULT_STREAMS_URL
scope = OptionScope.GLOBAL
is_secret = False
is_optional = True
is_list = False
store = OptionStores.SETTINGS
typing = "str"
default = ""
options = None
2 changes: 2 additions & 0 deletions haupt/haupt/common/settings/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def get_allowed_hosts():
context["UI_OFFLINE"] = config.ui_offline
context["UI_ENABLED"] = config.ui_enabled
context["UI_IN_SANDBOX"] = config.ui_in_sandbox
context["UI_SINGLE_URL"] = config.ui_single_url
context["UI_DEFAULT_STREAMS_URL"] = config.ui_default_streams_url
context["TEMPLATES_DEBUG"] = template_debug
context["LIST_TEMPLATE_CONTEXT_PROCESSORS"] = processors
context["TEMPLATES"] = [
Expand Down
6 changes: 6 additions & 0 deletions haupt/haupt/schemas/platform_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
ENV_KEYS_UI_ADMIN_ENABLED,
ENV_KEYS_UI_ASSETS_VERSION,
ENV_KEYS_UI_BASE_URL,
ENV_KEYS_UI_DEFAULT_STREAMS_URL,
ENV_KEYS_UI_ENABLED,
ENV_KEYS_UI_IN_SANDBOX,
ENV_KEYS_UI_OFFLINE,
ENV_KEYS_UI_SINGLE_URL,
)
from polyaxon._k8s.namespace import DEFAULT_NAMESPACE
from polyaxon._schemas.base import BaseSchemaModel
Expand Down Expand Up @@ -298,6 +300,10 @@ class PlatformConfig(BaseSchemaModel):
)
ui_offline: Optional[bool] = Field(alias=ENV_KEYS_UI_OFFLINE, default=False)
ui_enabled: Optional[bool] = Field(alias=ENV_KEYS_UI_ENABLED, default=True)
ui_single_url: Optional[bool] = Field(alias=ENV_KEYS_UI_SINGLE_URL, default=False)
ui_default_streams_url: Optional[str] = Field(
alias=ENV_KEYS_UI_DEFAULT_STREAMS_URL, default=None
)

class Config:
extra = Extra.ignore
Expand Down
2 changes: 2 additions & 0 deletions haupt/haupt/schemas/proxies_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ENV_KEYS_STATIC_ROOT,
ENV_KEYS_STATIC_URL,
ENV_KEYS_UI_ADMIN_ENABLED,
ENV_KEYS_UI_SINGLE_URL,
)
from polyaxon._schemas.base import BaseSchemaModel
from polyaxon.api import STATIC_V1
Expand Down Expand Up @@ -121,6 +122,7 @@ class ProxiesConfig(BaseSchemaModel):
)
static_url: Optional[str] = Field(alias=ENV_KEYS_STATIC_URL)
ui_admin_enabled: Optional[bool] = Field(alias=ENV_KEYS_UI_ADMIN_ENABLED)
ui_single_url: Optional[str] = Field(alias=ENV_KEYS_UI_SINGLE_URL)
has_forward_proxy: Optional[bool] = Field(alias=ENV_KEYS_PROXY_HAS_FORWARD_PROXY)
forward_proxy_port: Optional[int] = Field(alias=ENV_KEYS_PROXY_FORWARD_PROXY_PORT)
forward_proxy_host: Optional[str] = Field(alias=ENV_KEYS_PROXY_FORWARD_PROXY_HOST)
Expand Down
6 changes: 5 additions & 1 deletion haupt/tests/tests_common/test_options/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ def test_options_core(self):
assert core.UiAdminEnabled.is_global() is True
assert core.UiAdminEnabled.is_optional is True
assert core.UiAdminEnabled.get_key_subject() == "UI_ADMIN_ENABLED"
assert core.UiAdminEnabled.get_namespace() is None
assert core.UiBaseUrl.get_key_subject() == "UI_BASE_URL"
assert core.UiAssetsVersion.get_key_subject() == "UI_ASSETS_VERSION"
assert core.UiAdminEnabled.get_namespace() is None
assert core.UiDefaultStreamsUrl.get_key_subject() == "UI_DEFAULT_STREAMS_URL"
assert core.UiDefaultStreamsUrl.get_namespace() is None
assert core.UiSingleUrl.get_key_subject() == "UI_SINGLE_URL"
assert core.UiSingleUrl.get_namespace() is None

def test_options_scheduler(self):
assert scheduler.SchedulerCountdown.get_namespace() is None
Expand Down

0 comments on commit ce15b65

Please sign in to comment.