1
0

options.go 721 B

1234567891011121314151617181920212223242526272829303132333435
  1. package config
  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. // WithLoader sets the loader for manager config
  8. func WithLoader(l loader.Loader) Option {
  9. return func(o *Options) {
  10. o.Loader = l
  11. }
  12. }
  13. // WithSource appends a source to list of sources
  14. func WithSource(s source.Source) Option {
  15. return func(o *Options) {
  16. o.Source = append(o.Source, s)
  17. }
  18. }
  19. // WithReader sets the config reader
  20. func WithReader(r reader.Reader) Option {
  21. return func(o *Options) {
  22. o.Reader = r
  23. }
  24. }
  25. // WithEntity sets the config Entity
  26. func WithEntity(e Entity) Option {
  27. return func(o *Options) {
  28. o.Entity = e
  29. }
  30. }