mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-12 08:23:58 +02:00
19 lines
290 B
Go
19 lines
290 B
Go
package url
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go-micro.dev/v4/config/source"
|
|
)
|
|
|
|
type urlKey struct{}
|
|
|
|
func WithURL(u string) source.Option {
|
|
return func(o *source.Options) {
|
|
if o.Context == nil {
|
|
o.Context = context.Background()
|
|
}
|
|
o.Context = context.WithValue(o.Context, urlKey{}, u)
|
|
}
|
|
}
|