mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-08 09:30:44 +01:00
Read Temporal URL from config
Add TEMPOLAR_URL default ("temporal:7233") to Config and use
config.TEMPOLAR_URL when connecting the Temporal client. Also import
config in temporal module and remove a duplicate httpx import.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
from httpx import Client
|
||||
from pydantic import BaseModel
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
from httpx import Client
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
VAULT_HOST: str
|
||||
@@ -35,6 +34,8 @@ class Config(BaseModel):
|
||||
|
||||
OPENAI_API_KEY: str
|
||||
|
||||
TEMPOLAR_URL: str = "temporal:7233"
|
||||
|
||||
|
||||
def get_config() -> Config:
|
||||
settings = Settings() # type: ignore
|
||||
@@ -45,7 +46,7 @@ def get_config() -> Config:
|
||||
headers={
|
||||
"X-Vault-Token": settings.VAULT_TOKEN,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from temporalio.client import Client
|
||||
from temporalio.contrib.pydantic import pydantic_data_converter
|
||||
|
||||
from core.config import config
|
||||
|
||||
|
||||
async def get_client() -> Client:
|
||||
return await Client.connect(
|
||||
"temporal:7233",
|
||||
namespace="default",
|
||||
data_converter=pydantic_data_converter
|
||||
config.TEMPOLAR_URL, namespace="default", data_converter=pydantic_data_converter
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user