options.go 353 B

12345678910111213141516171819
  1. package file
  2. import (
  3. "context"
  4. "gogs.baozhida.cn/zoie/OAuth-core/config/source"
  5. )
  6. type filePathKey struct{}
  7. // WithPath sets the path to file
  8. func WithPath(p string) source.Option {
  9. return func(o *source.Options) {
  10. if o.Context == nil {
  11. o.Context = context.Background()
  12. }
  13. o.Context = context.WithValue(o.Context, filePathKey{}, p)
  14. }
  15. }