mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
fix(outbound): keep dial pinning for hops the environment proxy declines
This commit is contained in:
@@ -380,6 +380,13 @@ func (a *Api) Validate() error {
|
||||
err = errors.Join(err, errors.New("IP must be a valid IP address"))
|
||||
}
|
||||
|
||||
if a.downloadFromCfg.enableEnvironmentProxy {
|
||||
proxyErr := gotenberg.ValidateEnvironmentProxyVariables()
|
||||
if proxyErr != nil {
|
||||
err = errors.Join(err, fmt.Errorf("--api-download-from-enable-environment-proxy is set: %w", proxyErr))
|
||||
}
|
||||
}
|
||||
|
||||
if (a.tlsCertFile != "" && a.tlsKeyFile == "") || (a.tlsCertFile == "" && a.tlsKeyFile != "") {
|
||||
err = errors.Join(err,
|
||||
errors.New("both TLS certificate and key files must be set"),
|
||||
|
||||
@@ -669,6 +669,13 @@ func (mod *Chromium) Validate() error {
|
||||
return fmt.Errorf("chromium-max-concurrency must be between 1 and 6, got %d", mod.maxConcurrency)
|
||||
}
|
||||
|
||||
if mod.args.enableEnvironmentProxy {
|
||||
proxyErr := gotenberg.ValidateEnvironmentProxyVariables()
|
||||
if proxyErr != nil {
|
||||
return fmt.Errorf("--chromium-enable-environment-proxy is set: %w", proxyErr)
|
||||
}
|
||||
}
|
||||
|
||||
_, err := os.Stat(mod.args.binPath)
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("Chromium binary does not exist at %q; check the CHROMIUM_BIN_PATH environment variable: %w", mod.args.binPath, err)
|
||||
|
||||
@@ -522,6 +522,13 @@ func (a *Api) Validate() error {
|
||||
err = errors.Join(err, fmt.Errorf("unoconverter binary does not exist at %q; check the UNOCONVERTER_BIN_PATH environment variable: %w", a.args.unoBinPath, statErr))
|
||||
}
|
||||
|
||||
if a.args.proxyOptions.enableEnvironmentProxy {
|
||||
proxyErr := gotenberg.ValidateEnvironmentProxyVariables()
|
||||
if proxyErr != nil {
|
||||
err = errors.Join(err, fmt.Errorf("--libreoffice-enable-environment-proxy is set: %w", proxyErr))
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package webhook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -107,10 +108,25 @@ func (w *Webhook) AsyncCount() int64 {
|
||||
return w.asyncCount.Load()
|
||||
}
|
||||
|
||||
// Validate checks the module's configuration.
|
||||
func (w *Webhook) Validate() error {
|
||||
if !w.enableEnvironmentProxy {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := gotenberg.ValidateEnvironmentProxyVariables()
|
||||
if err != nil {
|
||||
return fmt.Errorf("--webhook-enable-environment-proxy is set: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Interface guards.
|
||||
var (
|
||||
_ gotenberg.Module = (*Webhook)(nil)
|
||||
_ gotenberg.Provisioner = (*Webhook)(nil)
|
||||
_ gotenberg.Validator = (*Webhook)(nil)
|
||||
_ api.MiddlewareProvider = (*Webhook)(nil)
|
||||
_ api.AsynchronousCounter = (*Webhook)(nil)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user