Skip to content

Commit

Permalink
Add configurable enviroment variables (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomperez98 authored Jan 7, 2025
1 parent bdf0b3a commit 7958836
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/resonate/stores/remote.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import time
from typing import TYPE_CHECKING, Any, Literal, final

Expand Down Expand Up @@ -327,10 +328,12 @@ def heartbeat(self, *, pid: str) -> int:
class RemoteStore:
def __init__(
self,
url: str = "http://localhost:8001",
url: str | None = None,
connect_timeout: int = 5,
request_timeout: int = 5,
) -> None:
if url is None:
url = os.getenv("RESONATE_SERVER", "http://localhost:8002")
self.url = url
self._encoder = Base64Encoder()
self._session = requests.Session()
Expand Down
5 changes: 4 additions & 1 deletion src/resonate/task_sources/poller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import time
from threading import Thread
from typing import Any
Expand All @@ -16,9 +17,11 @@
class Poller(ITaskSource):
def __init__(
self,
url: str = "http://localhost:8002",
url: str | None = None,
group: str = "default",
) -> None:
if url is None:
url = os.getenv("RESONATE_POLLER", "http://localhost:8002")
self._url = url
self._group = group
self._encoder = JsonEncoder()
Expand Down

0 comments on commit 7958836

Please sign in to comment.