mirror of
https://gitea.com/gitea/act_runner.git
synced 2024-11-10 04:37:22 +01:00
4d7ef95d40
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
31 lines
564 B
Go
31 lines
564 B
Go
package engine
|
|
|
|
import "github.com/docker/docker/client"
|
|
|
|
// An Option configures a mutex.
|
|
type Option interface {
|
|
Apply(*Docker)
|
|
}
|
|
|
|
// OptionFunc is a function that configure a value.
|
|
type OptionFunc func(*Docker)
|
|
|
|
// Apply calls f(option)
|
|
func (f OptionFunc) Apply(docker *Docker) {
|
|
f(docker)
|
|
}
|
|
|
|
// WithClient set custom client
|
|
func WithClient(c client.APIClient) Option {
|
|
return OptionFunc(func(q *Docker) {
|
|
q.client = c
|
|
})
|
|
}
|
|
|
|
// WithHidePull hide pull event.
|
|
func WithHidePull(v bool) Option {
|
|
return OptionFunc(func(q *Docker) {
|
|
q.hidePull = v
|
|
})
|
|
}
|