options.go 490 B

123456789101112131415161718192021
  1. package memory
  2. import (
  3. "gogs.baozhida.cn/zoie/OAuth-core/config/loader"
  4. "gogs.baozhida.cn/zoie/OAuth-core/config/reader"
  5. "gogs.baozhida.cn/zoie/OAuth-core/config/source"
  6. )
  7. // WithSource appends a source to list of sources
  8. func WithSource(s source.Source) loader.Option {
  9. return func(o *loader.Options) {
  10. o.Source = append(o.Source, s)
  11. }
  12. }
  13. // WithReader sets the config reader
  14. func WithReader(r reader.Reader) loader.Option {
  15. return func(o *loader.Options) {
  16. o.Reader = r
  17. }
  18. }