diff --git a/build/docs/content/03-environment-variables.md b/build/docs/content/03-environment-variables.md index b1522740..61ef06b4 100644 --- a/build/docs/content/03-environment-variables.md +++ b/build/docs/content/03-environment-variables.md @@ -58,6 +58,10 @@ The hard limit is 100 MB and is defined by Google Chrome itself. > The default Google Chrome rpcc buffer size may also be overridden per request thanks to the form field `googleChromeRpccBufferSize`. > See the [rpcc buffer size section](#html.rpcc_buffer_size). +## Ignore certificate errors + +By default Chrome will not accept certificate errors when using the URL print method. Setting this environment variable to `"1"` will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production. + ## Disable LibreOffice (unoconv) You may also disable LibreOffice (unoconv) with `DISABLE_UNOCONV`. diff --git a/docs/index.html b/docs/index.html index 1ad30e01..f09933dc 100755 --- a/docs/index.html +++ b/docs/index.html @@ -167,14 +167,14 @@ $ make publish GOTENBERG_USER_GID=You may also add it in your Docker Compose stack:
-version: '3' +version: '3' -services: +services: # your other services - gotenberg: - image: thecodingmachine/gotenberg:6 + gotenberg: + image: thecodingmachine/gotenberg:6@@ -332,6 +332,12 @@ The hard limit is 100 MB and is defined by Google Chrome itself. See the rpcc buffer size section.++ +Ignore certificate errors
+ +By default the chrome instance will not accept certificate errors when using the URL print method. Setting this environment variable to
+"1"will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production.Disable LibreOffice (unoconv)
@@ -1700,14 +1706,14 @@ if the API is under heavy load.For instance, using the following Docker Compose file:
-version: '3' +version: '3' -services: +services: # your other services - gotenberg: - image: thecodingmachine/gotenberg:6 + gotenberg: + image: thecodingmachine/gotenberg:6You may now launch your services using:
diff --git a/internal/pkg/conf/conf_test.go b/internal/pkg/conf/conf_test.go index 678ac2aa..b7855023 100644 --- a/internal/pkg/conf/conf_test.go +++ b/internal/pkg/conf/conf_test.go @@ -380,6 +380,43 @@ func TestDefaultGoogleChromeRpccBufferSizeFromEnv(t *testing.T) { os.Unsetenv(DefaultGoogleChromeRpccBufferSizeEnvVar) } +func TestIgnoreCertificateErrorsFromEnv(t *testing.T) { + var ( + expected Config + result Config + err error + ) + // URL_IGNORE_CERTIFICATE_ERRORS correctly set to true. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "1") + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = true + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS correctly set to false. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "0") + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = false + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS wrongly set. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "foo") + expected = DefaultConfig() + result, err = FromEnv() + test.AssertError(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS not set at all. + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = false + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) +} + func TestGetters(t *testing.T) { result := DefaultConfig() assert.Equal(t, result.maximumWaitTimeout, result.MaximumWaitTimeout()) @@ -394,4 +431,5 @@ func TestGetters(t *testing.T) { assert.Equal(t, result.rootPath, result.RootPath()) assert.Equal(t, result.maximumGoogleChromeRpccBufferSize, result.MaximumGoogleChromeRpccBufferSize()) assert.Equal(t, result.defaultGoogleChromeRpccBufferSize, result.DefaultGoogleChromeRpccBufferSize()) + assert.Equal(t, result.urlIgnoreCertificateErrors, result.IgnoreCertificateErrors()) }