Skip to content

Commit

Permalink
chore: add api key for tunnel connection
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps committed Apr 17, 2024
1 parent e986475 commit 3b22656
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/flipt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,18 +374,19 @@ func run(ctx context.Context, logger *zap.Logger, cfg *config.Config) error {
tunnel := fmt.Sprintf("%s-%s.%s", cfg.Server.Cloud.Instance, cfg.Server.Cloud.Organization, cfg.Server.Cloud.Address)

tunnelServer := &client.Server{
TunnelGroup: tunnel,
Handler: httpServer.Handler,
TunnelGroup: tunnel,
Handler: httpServer.Handler,
Authenticator: client.BearerAuthenticator(cfg.Server.Cloud.Authentication.ApiKey),
}

// starts QUIC tunnel server to connect to Cloud
g.Go(func() error {
defer tunnelServer.Close()

logger.Info("tunnel available", zap.String("address", tunnel), zap.Int("port", cfg.Server.Cloud.Port))
logger.Info("cloud tunnel available", zap.String("address", tunnel), zap.Int("port", cfg.Server.Cloud.Port))

if err := tunnelServer.DialAndServe(ctx, fmt.Sprintf("%s:%d", tunnel, cfg.Server.Cloud.Port)); !errors.Is(err, http.ErrServerClosed) {
return fmt.Errorf("tunnel server: %w", err)
return fmt.Errorf("cloud tunnel server: %w", err)
}

return nil
Expand Down

0 comments on commit 3b22656

Please sign in to comment.