Skip to content

Commit

Permalink
fixed naming convention
Browse files Browse the repository at this point in the history
Signed-off-by: bugslayer-332 <[email protected]>
  • Loading branch information
severussnape321 committed Jul 16, 2023
1 parent be840c4 commit aa0169e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/collector/app/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *Collector) Start(options *flags.CollectorOptions) error {
Handler: c.spanHandlers.ZipkinSpansHandler,
TLSConfig: options.Zipkin.TLS,
HealthCheck: c.hCheck,
CORSSettings: options.Zipkin.CORSSettings,
CORSConfig: options.Zipkin.CORS,
Logger: c.logger,
MetricsFactory: c.metricsFactory,
KeepAlive: options.Zipkin.KeepAlive,
Expand Down
12 changes: 6 additions & 6 deletions cmd/collector/app/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ type CollectorOptions struct {
HTTPHostPort string
// TLS configures secure transport for Zipkin endpoint to collect spans
TLS tlscfg.Options
// CORSSettings allows CORS requests , sets the values for Allowed Headers and Allowed Origins.
CORSSettings corscfg.Options
// CORS allows CORS requests , sets the values for Allowed Headers and Allowed Origins.
CORS corscfg.Options
// KeepAlive configures allow Keep-Alive for Zipkin HTTP server
KeepAlive bool
}
Expand All @@ -155,8 +155,8 @@ type HTTPOptions struct {
ReadHeaderTimeout time.Duration
// IdleTimeout sets the respective parameter of http.Server
IdleTimeout time.Duration
// CORSSettings allows CORS requests , sets the values for Allowed Headers and Allowed Origins.
CORSSettings corscfg.Options
// CORS allows CORS requests , sets the values for Allowed Headers and Allowed Origins.
CORS corscfg.Options
}

// GRPCOptions defines options for a gRPC server
Expand Down Expand Up @@ -277,7 +277,7 @@ func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper, logger *zap.Logger)
if err := cOpts.OTLP.HTTP.initFromViper(v, logger, otlpServerFlagsCfg.HTTP); err != nil {
return cOpts, fmt.Errorf("failed to parse OTLP/HTTP server options: %w", err)
}
cOpts.OTLP.HTTP.CORSSettings = corsOTLPFlags.InitFromViper(v)
cOpts.OTLP.HTTP.CORS = corsOTLPFlags.InitFromViper(v)
if err := cOpts.OTLP.GRPC.initFromViper(v, logger, otlpServerFlagsCfg.GRPC); err != nil {
return cOpts, fmt.Errorf("failed to parse OTLP/gRPC server options: %w", err)
}
Expand All @@ -289,7 +289,7 @@ func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper, logger *zap.Logger)
} else {
return cOpts, fmt.Errorf("failed to parse Zipkin TLS options: %w", err)
}
cOpts.Zipkin.CORSSettings = corsZipkinFlags.InitFromViper(v)
cOpts.Zipkin.CORS = corsZipkinFlags.InitFromViper(v)

return cOpts, nil
}
4 changes: 2 additions & 2 deletions cmd/collector/app/handler/otlp_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func applyHTTPSettings(cfg *confighttp.HTTPServerSettings, opts *flags.HTTPOptio
if opts.TLS.Enabled {
cfg.TLSSetting = applyTLSSettings(&opts.TLS)
}
cfg.CORS.AllowedHeaders = opts.CORSSettings.AllowedHeaders
cfg.CORS.AllowedOrigins = opts.CORSSettings.AllowedOrigins
cfg.CORS.AllowedHeaders = opts.CORS.AllowedHeaders
cfg.CORS.AllowedOrigins = opts.CORS.AllowedOrigins
}

func applyTLSSettings(opts *tlscfg.Options) *configtls.TLSServerSetting {
Expand Down
6 changes: 3 additions & 3 deletions cmd/collector/app/server/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type ZipkinServerParams struct {
TLSConfig tlscfg.Options
HostPort string
Handler handler.ZipkinSpansHandler
CORSSettings corscfg.Options
CORSConfig corscfg.Options
HealthCheck *healthcheck.HealthCheck
Logger *zap.Logger
MetricsFactory metrics.Factory
Expand Down Expand Up @@ -86,9 +86,9 @@ func serveZipkin(server *http.Server, listener net.Listener, params *ZipkinServe
zHandler.RegisterRoutes(r)

cors := cors.New(cors.Options{
AllowedOrigins: params.CORSSettings.AllowedOrigins,
AllowedOrigins: params.CORSConfig.AllowedOrigins,
AllowedMethods: []string{"POST"}, // Allowing only POST, because that's the only handled one
AllowedHeaders: params.CORSSettings.AllowedHeaders,
AllowedHeaders: params.CORSConfig.AllowedHeaders,
})

recoveryHandler := recoveryhandler.NewRecoveryHandler(params.Logger, true)
Expand Down

0 comments on commit aa0169e

Please sign in to comment.