Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow emulator to bind to a configurable host #350

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/bigquery-emulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
type option struct {
Project string `description:"specify the project name" long:"project"`
Dataset string `description:"specify the dataset name" long:"dataset"`
Host string `description:"specify the host" long:"host" default:"0.0.0.0"`
HTTPPort uint16 `description:"specify the http port number. this port used by bigquery api" long:"port" default:"9050"`
GRPCPort uint16 `description:"specify the grpc port number. this port used by bigquery storage api" long:"grpc-port" default:"9060"`
LogLevel server.LogLevel `description:"specify the log level (debug/info/warn/error)" long:"log-level" default:"error"`
Expand Down Expand Up @@ -125,8 +126,8 @@ func runServer(args []string, opt option) error {

done := make(chan error)
go func() {
httpAddr := fmt.Sprintf("0.0.0.0:%d", opt.HTTPPort)
grpcAddr := fmt.Sprintf("0.0.0.0:%d", opt.GRPCPort)
httpAddr := fmt.Sprintf("%s:%d", opt.Host, opt.HTTPPort)
grpcAddr := fmt.Sprintf("%s:%d", opt.Host, opt.GRPCPort)
fmt.Fprintf(os.Stdout, "[bigquery-emulator] REST server listening at %s\n", httpAddr)
fmt.Fprintf(os.Stdout, "[bigquery-emulator] gRPC server listening at %s\n", grpcAddr)
done <- bqServer.Serve(ctx, httpAddr, grpcAddr)
Expand Down
Loading