github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/registry/memory/config.go (about)

     1  package memory
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/volts-dev/volts/registry"
     7  )
     8  
     9  // Services is an option that preloads service data.
    10  func Services(s map[string][]*registry.Service) registry.Option {
    11  	return func(o *registry.Config) {
    12  		if o.Context == nil {
    13  			o.Context = context.Background()
    14  		}
    15  		o.Context = context.WithValue(o.Context, servicesKey{}, s)
    16  	}
    17  }