# # Configuration

## # Configure docker-compose.yml

In this section, you can find all the FoxitPDFSDKforWeb Server configuration items available, which are configurable in `docker-composer.yml`.

S8_WEBPDF_MONGO_URI: This URI allow to access MongoDB. The example value is `mongodb://user:secret@mongo1.example.com:27017/com-foxit-webpdf`. If it is MongoDB cluster,then use comma to separate, for example, `mongodb://user:secret@mongo1.example.com:27017,mongo2.example.com:27017/com-foxit-webpdf`.

S8_WEBPDF_CACHE_DIRS: A cache folder for FoxitPDFSDKforWeb server. This option is useful when you need a share storage in a distributed environment . You can mount a shared folder to a Docker container and then specify the FoxitPDFSDKforWeb Server to use the shared folder as a cache directory. Make sure that the share folder is only used by FoxitPDFSDKforWeb server.

S8_WEBPDF_SECRET_JWT_ALG: The JWT authentication of the API interface (turned off by default). The valid values for the current version are HS256, HS384, HS512, RS256, RS384, and RS512. See the Security section for JWT.

S8_WEBPDF_SECRET_JWT_KEY: The secret key for JWT validation. When JWT Algorithm is HS256, HS384 and HS512, its value should be base64 form of JWT key. For example, the secret key is 123, then the value should be configured as MTIz. When JWT Algorithm is RS256, RS384, and RS512, its value should be RSA Public Key used for JWT validation. See the Security section for JWT.

S8_WEBPDF_CACHE_AGE: The minimum age for caching. The default value is `0` and unit is min. When the time is set as >30,the value between `0<x<30` is taken as 30. When the value is `<=0`, the cache will be preserved until the caching volume overrun the preset in `S8_WEBPDF_CACHE_MB`.See the section Cache Management for cache clearing.

S8_WEBPDF_CACHE_MB : The maximum size for caching. The default value is `0` and unit is MB. When the size is <=0, the cache will be preserved until the caching duration exceeds the preset in `S8_WEBPDF_CACHE_AGE`.See the section Cache Management for cache clearing.

S8_WEBPDF_GSDK_SN : The SN license information. Copy the whole text string after `SN=` in the license file you received, and paste into the respectively required field below. Extra spaces or modifications make invalid.

S8_WEBPDF_GSDK_KEY : The Key license information. Copy the whole text string after `Sign=` in the license file you received, and paste into the respectively required field below. Extra spaces or modifications make invalid.

S8_WEBPDF_HTTP_MAXSIZE: The maximum size of the allowed HTTP request. The default request value is 1024MB. The minimum configurable value is 10, values lessn than 0 will be ignored, and values between 0 and 10 will be treated as 10. This should be set up when the uploaded PDF document exceeds 1024MB.

## # Configure font

FoxitPDFSDKforWeb Server has a build-in font lib to ensure non-embedded fonts in a document can be rendered correctly. But if you want to display a document with a dedicated font or that contains double-byte characters, then you should configure font before getting FoxitPDFSDKforWeb Server running.

1. Download font package fonts.tar.gz and unzip it:

    tar zxf fonts.tar.gz -C /tmp

2. Map the font directory to`/usr/share/fonts` in `docker-compose.yml`:

    - /tmp/fonts:/usr/share/fonts

3. The `docker-compose.yml` would look like this:

    version: '2'
    services:
      webpdf:
        image: harbor.cpdf.io:4430/websdk-sr/master:latest
        ports:
          - 8890:8080
        environment:
          S8_WEBPDF_MONGO_URI: mongodb://mongo:mongo@mongo:27017/com-foxit-webpdf
          S8_WEBPDF_GSDK_SN:Copy the whole text string after `SN=`in the SN license file you received and paste here
          S8_WEBPDF_GSDK_KEY:Copy the whole text string after `Sign=`in the KEY license file you received and paste here
        volumes:
          - /tmp/fonts:/usr/share/fonts

Note: If you add external fonts after FoxitPDFSDKforWeb Server runs some time, you would need to manually clear the cache folder that specified in `S8_WEBPDF_CACHE_DIRS`, and restart the FoxitPDFSDKforWeb Server to take fonts effect.