Skip to content

Commit 4c5ac89

Browse files
committed
fix(flagd): only apply FLAGD_SYNC_PORT env var for in-process resolver
1 parent 55f8b69 commit 4c5ac89

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

  • providers/openfeature-provider-flagd

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/config.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def env_or_default(
8181

8282
@dataclasses.dataclass
8383
class Config:
84-
def __init__( # noqa: PLR0913
84+
def __init__( # noqa: PLR0913, PLR0915
8585
self,
8686
host: str | None = None,
8787
port: int | None = None,
@@ -181,13 +181,14 @@ def __init__( # noqa: PLR0913
181181
else:
182182
self.port = port
183183

184-
self.port = (
185-
int(env_or_default(ENV_VAR_SYNC_PORT, self.port, cast=int))
186-
if sync_port is None and port is None
187-
else sync_port
188-
if sync_port is not None
189-
else self.port
190-
)
184+
if sync_port is not None:
185+
self.port = sync_port
186+
elif (
187+
port is None
188+
and self.resolver is not ResolverType.RPC
189+
and os.environ.get(ENV_VAR_SYNC_PORT) is not None
190+
):
191+
self.port = int(env_or_default(ENV_VAR_SYNC_PORT, self.port, cast=int))
191192

192193
self.offline_flag_source_path = (
193194
env_or_default(

0 commit comments

Comments
 (0)