Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultShortpixelConfig = ShortpixelConfig{ Url: "", Url2: "", ApiKey: "", RetryTimes: 0, RetryPause: 0, Timeout: 0, Wait: "", UploadTimeout: 250 * time.Millisecond, DownloadTimeout: 250 * time.Millisecond, RepeatIn: 0, RestartIn: 0, } DefaultImaginaryConfig = ImaginaryConfig{ Host: "localhost", Port: "9001", RetryTimes: 4, RetryPause: 5 * time.Second, Timeout: 30 * time.Second, } )
Functions ¶
func New ¶
func New(ctx context.Context, conf CompressorConfig) (domain.Compresser, error)
func WithHeartbeatRestart ¶
func WithHeartbeatRestart(ch chan<- any) options
Types ¶
type CompressorConfig ¶
type CompressorConfig struct { Compressor string `mapstructure:"APP_COMPRESSOR" validate:"required"` Shortpixel ShortpixelConfig `mapstructure:",squash"` Imaginary ImaginaryConfig `mapstructure:",squash"` }
func (CompressorConfig) IsMock ¶
func (c CompressorConfig) IsMock() bool
type Imaginary ¶
type Imaginary struct {
// contains filtered or unexported fields
}
func NewImaginary ¶
func NewImaginary(ctx context.Context, conf ImaginaryConfig) (*Imaginary, error)
type ImaginaryConfig ¶
type ImaginaryConfig struct { Host string `mapstructure:"COMPRESSOR_IMAGINARY_HOST" validate:"required"` Port string `mapstructure:"COMPRESSOR_IMAGINARY_PORT" validate:"required"` RetryTimes int `mapstructure:"COMPRESSOR_IMAGINARY_RETRY_TIMES" validate:"required"` RetryPause time.Duration `mapstructure:"COMPRESSOR_IMAGINARY_RETRY_PAUSE" validate:"required"` Timeout time.Duration `mapstructure:"COMPRESSOR_IMAGINARY_TIMEOUT" validate:"required"` }
type Shortpixel ¶
type Shortpixel struct {
// contains filtered or unexported fields
}
func NewShortpixel ¶
func NewShortpixel(conf ShortpixelConfig, opts ...options) *Shortpixel
func (*Shortpixel) Monitor ¶
func (sp *Shortpixel) Monitor(ctx context.Context)
type ShortpixelConfig ¶
type ShortpixelConfig struct { Url string `mapstructure:"COMPRESSOR_SHORTPIXEL_URL" validate:"required"` Url2 string `mapstructure:"COMPRESSOR_SHORTPIXEL_URL2" validate:"required"` ApiKey string `mapstructure:"COMPRESSOR_SHORTPIXEL_API_KEY" validate:"required"` RetryTimes int `mapstructure:"COMPRESSOR_SHORTPIXEL_RETRY_TIMES" validate:"required"` RetryPause time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_RETRY_PAUSE" validate:"required"` Timeout time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_TIMEOUT" validate:"required"` Wait string `mapstructure:"COMPRESSOR_SHORTPIXEL_WAIT" validate:"required"` UploadTimeout time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_UPLOAD_TIMEOUT" validate:"required"` DownloadTimeout time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_DOWNLOAD_TIMEOUT" validate:"required"` RepeatIn time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_REPEAT_IN" validate:"required"` RestartIn time.Duration `mapstructure:"COMPRESSOR_SHORTPIXEL_RESTART_IN" validate:"required"` }
Click to show internal directories.
Click to hide internal directories.