Skip to content

Commit

Permalink
fix: use 127.0.0.1 instead of 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hironori Yamamoto committed Dec 17, 2024
1 parent 28c82ae commit 2d20b8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bqemulatormanager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Manager:
def __init__(
self,
project: str = "test",
host: str = "localhost",
port: int = 9050,
grpc_port: int = 9060,
schema_path: str = "bqem_master_schema.yaml",
Expand All @@ -38,7 +39,7 @@ def __init__(
else:
raise RuntimeError(f"there is no empty port from {original_port} to {port}")

self.client = self._make_client(project, port)
self.client = self._make_client(project_name=project, host=host, port=port)

prod_client = bigquery.Client(project, credentials=AnonymousCredentials())

Expand All @@ -54,8 +55,8 @@ def __exit__(self, exc_type, exc_value, traceback):
del self.schema_manager

@staticmethod
def _make_client(project_name: str, port: int) -> bigquery.Client:
client_options = ClientOptions(api_endpoint=f"http://0.0.0.0:{port}")
def _make_client(project_name: str, host: str, port: int) -> bigquery.Client:
client_options = ClientOptions(api_endpoint=f"http://{host}:{port}")
client = bigquery.Client(
project_name,
client_options=client_options,
Expand Down

0 comments on commit 2d20b8e

Please sign in to comment.