Skip to content

Commit 979d217

Browse files
authored
fix: Set a default console url (#289)
1 parent 571f44c commit 979d217

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/galileo/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
# We need to ignore syntax errors until https://github.com/python/mypy/issues/17535 is resolved.
33
from typing import Any, Optional
44

5+
from pydantic_core import Url
6+
57
from galileo_core.schemas.base_config import GalileoConfig
68

79

810
class GalileoPythonConfig(GalileoConfig):
911
# Config file for this project.
1012
config_filename: str = "galileo-python-config.json"
13+
console_url: Url = "https://app.galileo.ai"
1114

1215
def reset(self) -> None:
1316
global _galileo_config

tests/test_config.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from unittest.mock import patch
2+
3+
from galileo.config import GalileoPythonConfig
4+
5+
6+
@patch("galileo_core.schemas.base_config.GalileoConfig.set_validated_api_client", new=lambda x: x)
7+
@patch("galileo_core.schemas.base_config.GalileoConfig.get_jwt_token")
8+
def test_default_console_url(mock_get_jwt_token):
9+
"""
10+
Test that the default console_url is used when GALILEO_CONSOLE_URL is not set.
11+
"""
12+
mock_get_jwt_token.return_value = ("mock_jwt_token", "mock_refresh_token")
13+
14+
# Unset the environment variable to ensure we test the default
15+
with patch.dict("os.environ", {}, clear=True):
16+
# Reset the global config object to force re-initialization
17+
GalileoPythonConfig.get().reset()
18+
config = GalileoPythonConfig.get(api_key="mock_api_key")
19+
20+
assert str(config.console_url) == "https://app.galileo.ai/"
21+
assert str(config.api_url) == "https://api.galileo.ai/"

0 commit comments

Comments
 (0)