Visitar URL original
feat: Add TLS support for Go Feature Server by shuchu · Pull Request #6229 · feast-dev/feast · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: Format code. Fixed bad comments.
Signed-off-by: Shuchu Han <shuchu.han@gmail.com>
  • Loading branch information
shuchu authored and SHUCHU HAN committed Apr 14, 2026
commit 531042a14e9eb85b4f5f79ebc3bcd14373cc25b9
28 changes: 14 additions & 14 deletions go/internal/feast/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package server

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
"runtime"
"strconv"
"time"
"crypto/tls"

"github.com/feast-dev/feast/go/internal/feast"
"github.com/feast-dev/feast/go/internal/feast/model"
Expand Down Expand Up @@ -402,22 +402,22 @@ func (s *httpServer) ServeTLS(host string, port int, certFile string, keyFile st
mux.Handle("/get-online-features", metricsMiddleware(recoverMiddleware(http.HandlerFunc(s.getOnlineFeatures))))
mux.Handle("/health", metricsMiddleware(http.HandlerFunc(healthCheckHandler)))
s.server = &http.Server{
Addr: fmt.Sprintf("%s:%d", host, port),
Handler: mux,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 15 * time.Second,
Addr: fmt.Sprintf("%s:%d", host, port),
Handler: mux,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 15 * time.Second,
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
// For production, use proper certificates
// Prefer server's cipher suites
PreferServerCipherSuites: true,
CurvePreferences: []tls.CurveID{
tls.CurveP256,
MinVersion: tls.VersionTLS12,
// For production, use proper certificates
// Prefer server's cipher suites
PreferServerCipherSuites: true,
Comment thread
shuchu marked this conversation as resolved.
Outdated
CurvePreferences: []tls.CurveID{
tls.CurveP256,
tls.X25519MLKEM768,
tls.SecP256r1MLKEM768,
},
},
},
},
}
err := s.server.ListenAndServeTLS(certFile, keyFile)
// Don't return the error if it's caused by graceful shutdown using Stop()
Expand Down
2 changes: 0 additions & 2 deletions go/internal/feast/server/http_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,3 @@ func TestMarshalInt64JSON(t *testing.T) {
assert.Equal(t, expectedJSON, string(jsonData), "JSON output does not match expected")
assert.IsType(t, &array.Int64{}, arrowArray, "arrowArray is not of type *array.Int64")
}


4 changes: 2 additions & 2 deletions go/main.go
Comment thread
shuchu marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ func newTracerProvider(exp sdktrace.SpanExporter) (*sdktrace.TracerProvider, err
), nil
}

// StartHttpsServer starts HTTP server with TLS. Requires TLS_CERT_FILE and TLS_KEY_FILE env vars.
// StartHttpsServer starts HTTP server with TLS. Requires --tls-cert-file and --tls-key-file flags
func StartHttpsServer(fs *feast.FeatureStore, host string, port int, metricsPort int, certFile string, keyFile string, writeLoggedFeaturesCallback logging.OfflineStoreWriteCallback, loggingOpts *logging.LoggingOptions) error {
if certFile == "" || keyFile == "" {
return fmt.Errorf("TLS_CERT_FILE and TLS_KEY_FILE must be set")
return fmt.Errorf("--tls-cert-file and --tls-key-file must be provided")
}

loggingService, err := constructLoggingService(fs, writeLoggedFeaturesCallback, loggingOpts)
Expand Down