WebFix develop (#14040)

* fixing issues introduced by PR 13593

* missed setting db

* linting
This commit is contained in:
james-prysm
2024-05-23 09:07:30 -05:00
committed by GitHub
parent 2265af58ae
commit 2e84208169
4 changed files with 30 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ func (s *Server) AuthTokenInterceptor() grpc.UnaryServerInterceptor {
func (s *Server) AuthTokenHandler(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// if it's not initialize or has a web prefix
if strings.Contains(r.URL.Path, api.WebApiUrlPrefix) || strings.Contains(r.URL.Path, api.KeymanagerApiPrefix) {
if (strings.Contains(r.URL.Path, api.WebApiUrlPrefix) || strings.Contains(r.URL.Path, api.KeymanagerApiPrefix)) && !strings.Contains(r.URL.Path, api.SystemLogsPrefix) {
// ignore some routes
reqToken := r.Header.Get("Authorization")
if reqToken == "" {

View File

@@ -47,6 +47,7 @@ type Config struct {
WalletDir string
WalletInitializedFeed *event.Feed
ValidatorService *client.ValidatorService
AuthTokenPath string
Router *mux.Router
}
@@ -92,6 +93,8 @@ func NewServer(ctx context.Context, cfg *Config) *Server {
server := &Server{
ctx: ctx,
cancel: cancel,
logStreamer: logs.NewStreamServer(),
logStreamerBufferSize: 1000, // Enough to handle most bursts of logs in the validator client.
host: cfg.Host,
port: cfg.Port,
grpcGatewayHost: cfg.GRPCGatewayHost,
@@ -100,6 +103,17 @@ func NewServer(ctx context.Context, cfg *Config) *Server {
grpcRetries: cfg.GRPCRetries,
grpcRetryDelay: cfg.GRPCRetryDelay,
grpcHeaders: cfg.GRPCHeaders,
validatorService: cfg.ValidatorService,
authTokenPath: cfg.AuthTokenPath,
db: cfg.DB,
walletDir: cfg.WalletDir,
walletInitializedFeed: cfg.WalletInitializedFeed,
walletInitialized: cfg.Wallet != nil,
wallet: cfg.Wallet,
beaconApiTimeout: cfg.BeaconApiTimeout,
beaconApiEndpoint: cfg.BeaconApiEndpoint,
beaconNodeEndpoint: cfg.BeaconNodeGRPCEndpoint,
router: cfg.Router,
}
if server.authTokenPath == "" && server.walletDir != "" {