mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 04:12:16 +01:00
Add feature to have chrome ignore certificate errors when printing using an URL.
This commit is contained in:
@@ -40,6 +40,8 @@ const (
|
||||
// DefaultGoogleChromeRpccBufferSizeEnvVar contains the name
|
||||
// of the environment variable "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE".
|
||||
DefaultGoogleChromeRpccBufferSizeEnvVar string = "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE"
|
||||
// Allow self signed certificates when using a remote url
|
||||
URLIgnoreCertificateErrorsEnvVar string = "URL_IGNORE_CERTIFICATE_ERRORS"
|
||||
)
|
||||
|
||||
// Config contains the application
|
||||
@@ -53,6 +55,7 @@ type Config struct {
|
||||
defaultListenPort int64
|
||||
disableGoogleChrome bool
|
||||
disableUnoconv bool
|
||||
urlIgnoreCertificateErrors bool
|
||||
logLevel xlog.Level
|
||||
rootPath string
|
||||
maximumGoogleChromeRpccBufferSize int64
|
||||
@@ -75,6 +78,7 @@ func DefaultConfig() Config {
|
||||
rootPath: "/",
|
||||
maximumGoogleChromeRpccBufferSize: 104857600, // ~100 MB
|
||||
defaultGoogleChromeRpccBufferSize: 1048576, // 1 MB
|
||||
urlIgnoreCertificateErrors: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +192,14 @@ func FromEnv() (Config, error) {
|
||||
if err != nil {
|
||||
return c, err
|
||||
}
|
||||
urlIgnoreCertificateErrors, err := xassert.BoolFromEnv(
|
||||
URLIgnoreCertificateErrorsEnvVar,
|
||||
c.urlIgnoreCertificateErrors,
|
||||
)
|
||||
c.urlIgnoreCertificateErrors = urlIgnoreCertificateErrors
|
||||
if err != nil {
|
||||
return c, err
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
result, err := resolver()
|
||||
@@ -274,3 +286,10 @@ func (c Config) MaximumGoogleChromeRpccBufferSize() int64 {
|
||||
func (c Config) DefaultGoogleChromeRpccBufferSize() int64 {
|
||||
return c.defaultGoogleChromeRpccBufferSize
|
||||
}
|
||||
|
||||
// IgnoreCertificateErrors returns true if
|
||||
// Google Chrome should ignore certificate errors
|
||||
// in case of self signed certificates for example.
|
||||
func (c Config) IgnoreCertificateErrors() bool {
|
||||
return c.urlIgnoreCertificateErrors
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user