github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/testutil/registry/ops.go (about)

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