mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 20:32:13 +01:00
Add ignoreCertificateErrors tests + docs
This commit is contained in:
@@ -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`.
|
> 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).
|
> 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)
|
## Disable LibreOffice (unoconv)
|
||||||
|
|
||||||
You may also disable LibreOffice (unoconv) with `DISABLE_UNOCONV`.
|
You may also disable LibreOffice (unoconv) with `DISABLE_UNOCONV`.
|
||||||
|
|||||||
@@ -167,14 +167,14 @@ $ make publish <span class="nv">GOTENBERG_USER_GID</span><span class="o">=</span
|
|||||||
|
|
||||||
<p>You may also add it in your Docker Compose stack:</p>
|
<p>You may also add it in your Docker Compose stack:</p>
|
||||||
|
|
||||||
<pre class="chroma"><span class="k">version</span><span class="p">:</span><span class="w"> </span><span class="s1">'3'</span><span class="w">
|
<pre class="chroma"><span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="s1">'3'</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"></span><span class="k">services</span><span class="p">:</span><span class="w">
|
</span><span class="w"></span><span class="nt">services</span><span class="p">:</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="c"># your other services</span><span class="w">
|
</span><span class="w"> </span><span class="c"># your other services</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="k">gotenberg</span><span class="p">:</span><span class="w">
|
</span><span class="w"> </span><span class="nt">gotenberg</span><span class="p">:</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="k">image</span><span class="p">:</span><span class="w"> </span>thecodingmachine/gotenberg<span class="p">:</span><span class="m">6</span><span class="w">
|
</span><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">thecodingmachine/gotenberg:6</span><span class="w">
|
||||||
</span></pre>
|
</span></pre>
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
@@ -332,6 +332,12 @@ The hard limit is 100 MB and is defined by Google Chrome itself.</p>
|
|||||||
See the <a href="#html.rpcc_buffer_size">rpcc buffer size section</a>.</p>
|
See the <a href="#html.rpcc_buffer_size">rpcc buffer size section</a>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="environment_variables.ignore_certificate_errors" href="#environment_variables.ignore_certificate_errors">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
|
</a>Ignore certificate errors</h2>
|
||||||
|
|
||||||
|
<p>By default the chrome instance will not accept certificate errors when using the URL print method. Setting this environment variable to <code>"1"</code> will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production.</p>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="environment_variables.disable_libre_office_unoconv" href="#environment_variables.disable_libre_office_unoconv">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="environment_variables.disable_libre_office_unoconv" href="#environment_variables.disable_libre_office_unoconv">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Disable LibreOffice (unoconv)</h2>
|
</a>Disable LibreOffice (unoconv)</h2>
|
||||||
@@ -1700,14 +1706,14 @@ if the API is under heavy load.</p>
|
|||||||
|
|
||||||
<p>For instance, using the following Docker Compose file:</p>
|
<p>For instance, using the following Docker Compose file:</p>
|
||||||
|
|
||||||
<pre class="chroma"><span class="k">version</span><span class="p">:</span><span class="w"> </span><span class="s1">'3'</span><span class="w">
|
<pre class="chroma"><span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="s1">'3'</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"></span><span class="k">services</span><span class="p">:</span><span class="w">
|
</span><span class="w"></span><span class="nt">services</span><span class="p">:</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="c"># your other services</span><span class="w">
|
</span><span class="w"> </span><span class="c"># your other services</span><span class="w">
|
||||||
</span><span class="w">
|
</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="k">gotenberg</span><span class="p">:</span><span class="w">
|
</span><span class="w"> </span><span class="nt">gotenberg</span><span class="p">:</span><span class="w">
|
||||||
</span><span class="w"> </span><span class="k">image</span><span class="p">:</span><span class="w"> </span>thecodingmachine/gotenberg<span class="p">:</span><span class="m">6</span><span class="w">
|
</span><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">thecodingmachine/gotenberg:6</span><span class="w">
|
||||||
</span></pre>
|
</span></pre>
|
||||||
|
|
||||||
<p>You may now launch your services using:</p>
|
<p>You may now launch your services using:</p>
|
||||||
|
|||||||
@@ -380,6 +380,43 @@ func TestDefaultGoogleChromeRpccBufferSizeFromEnv(t *testing.T) {
|
|||||||
os.Unsetenv(DefaultGoogleChromeRpccBufferSizeEnvVar)
|
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) {
|
func TestGetters(t *testing.T) {
|
||||||
result := DefaultConfig()
|
result := DefaultConfig()
|
||||||
assert.Equal(t, result.maximumWaitTimeout, result.MaximumWaitTimeout())
|
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.rootPath, result.RootPath())
|
||||||
assert.Equal(t, result.maximumGoogleChromeRpccBufferSize, result.MaximumGoogleChromeRpccBufferSize())
|
assert.Equal(t, result.maximumGoogleChromeRpccBufferSize, result.MaximumGoogleChromeRpccBufferSize())
|
||||||
assert.Equal(t, result.defaultGoogleChromeRpccBufferSize, result.DefaultGoogleChromeRpccBufferSize())
|
assert.Equal(t, result.defaultGoogleChromeRpccBufferSize, result.DefaultGoogleChromeRpccBufferSize())
|
||||||
|
assert.Equal(t, result.urlIgnoreCertificateErrors, result.IgnoreCertificateErrors())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user