Files
ocis/services/sharing/pkg/server/debug/server.go
T
Roman PerekhodandClaude Opus 5.5 1ca8feaf68 refactor: [OCSRE-1629] map the NATS config in one place for each service
- The search, sharing, storage-users, ocs and gateway config structs
  now have a method that returns the stream.NatsConfig. Before, the
  same literal was in 7 places. A new NATS field then needed 7 edits.
  A test fails when a field of stream.NatsConfig is not mapped.
- Remove the CredsFile and Creds fields from shared.Cache. No service
  copied these fields from the commons, so they had no effect.
- Add a changelog entry for the provider cache persistence fix of the
  gateway service.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 19:49:50 +01:00

36 lines
1.3 KiB
Go

package debug
import (
"net/http"
"github.com/owncloud/ocis/v2/ocis-pkg/checks"
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
)
// Server initializes the debug service and server.
func Server(opts ...Option) (*http.Server, error) {
options := newOptions(opts...)
readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Addr, options.Config.Events.NatsConfig())).
WithCheck("grpc reachability", checks.NewGRPCCheck(options.Config.GRPC.Addr))
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(version.GetString()),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Ready(handlers.NewCheckHandler(readyHandlerConfiguration)),
//debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins),
//debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods),
//debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders),
//debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials),
), nil
}