mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-31 05:50:08 +00:00
Add server version to websocket pings
This commit is contained in:
parent
b219ba5d7c
commit
4a34cec914
@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache clustercache.ClusterCache,
|
||||
cg proxy.ClientGetter, schemaFactory steveschema.Factory) error {
|
||||
cg proxy.ClientGetter, schemaFactory steveschema.Factory, serverVersion string) error {
|
||||
counts.Register(baseSchema, ccache)
|
||||
subscribe.Register(baseSchema, func(apiOp *types.APIRequest) *types.APISchemas {
|
||||
user, ok := request.UserFrom(apiOp.Context())
|
||||
@ -35,7 +35,7 @@ func DefaultSchemas(ctx context.Context, baseSchema *types.APISchemas, ccache cl
|
||||
}
|
||||
}
|
||||
return apiOp.Schemas
|
||||
})
|
||||
}, serverVersion)
|
||||
apiroot.Register(baseSchema, []string{"v1"}, "proxy:/apis")
|
||||
cluster.Register(ctx, baseSchema, cg, schemaFactory)
|
||||
userpreferences.Register(baseSchema)
|
||||
|
@ -37,6 +37,7 @@ type Server struct {
|
||||
AccessSetLookup accesscontrol.AccessSetLookup
|
||||
APIServer *apiserver.Server
|
||||
ClusterRegistry string
|
||||
Version string
|
||||
|
||||
authMiddleware auth.Middleware
|
||||
controllers *Controllers
|
||||
@ -59,6 +60,7 @@ type Options struct {
|
||||
AggregationSecretNamespace string
|
||||
AggregationSecretName string
|
||||
ClusterRegistry string
|
||||
ServerVersion string
|
||||
}
|
||||
|
||||
func New(ctx context.Context, restConfig *rest.Config, opts *Options) (*Server, error) {
|
||||
@ -77,6 +79,7 @@ func New(ctx context.Context, restConfig *rest.Config, opts *Options) (*Server,
|
||||
aggregationSecretNamespace: opts.AggregationSecretNamespace,
|
||||
aggregationSecretName: opts.AggregationSecretName,
|
||||
ClusterRegistry: opts.ClusterRegistry,
|
||||
Version: opts.ServerVersion,
|
||||
}
|
||||
|
||||
if err := setup(ctx, server); err != nil {
|
||||
@ -135,7 +138,7 @@ func setup(ctx context.Context, server *Server) error {
|
||||
server.ClusterCache = ccache
|
||||
sf := schema.NewCollection(ctx, server.BaseSchemas, asl)
|
||||
|
||||
if err = resources.DefaultSchemas(ctx, server.BaseSchemas, ccache, server.ClientFactory, sf); err != nil {
|
||||
if err = resources.DefaultSchemas(ctx, server.BaseSchemas, ccache, server.ClientFactory, sf, server.Version); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user