ops.go 890 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package registry
  2. import "io"
  3. // Schema1 sets the registry to serve v1 api
  4. func Schema1(c *Config) {
  5. c.schema1 = true
  6. }
  7. // Htpasswd sets the auth method with htpasswd
  8. func Htpasswd(c *Config) {
  9. c.auth = "htpasswd"
  10. }
  11. // Token sets the auth method to token, with the specified token url
  12. func Token(tokenURL string) func(*Config) {
  13. return func(c *Config) {
  14. c.auth = "token"
  15. c.tokenURL = tokenURL
  16. }
  17. }
  18. // URL sets the registry url
  19. func URL(registryURL string) func(*Config) {
  20. return func(c *Config) {
  21. c.registryURL = registryURL
  22. }
  23. }
  24. // WithStdout sets the stdout of the registry command to the passed in writer.
  25. func WithStdout(w io.Writer) func(c *Config) {
  26. return func(c *Config) {
  27. c.stdout = w
  28. }
  29. }
  30. // WithStderr sets the stdout of the registry command to the passed in writer.
  31. func WithStderr(w io.Writer) func(c *Config) {
  32. return func(c *Config) {
  33. c.stderr = w
  34. }
  35. }