Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Latest commit

 

History

History
34 lines (27 loc) · 2.52 KB

configure.md

File metadata and controls

34 lines (27 loc) · 2.52 KB

Config

When deploying the service, set configuration variables by including a config.json in the root. Available configuration options:

  • timeout default 10000 - set the timeout used to render the target page.
  • port default 3000 - set the port to use for running and listening the rendertron service. Note if process.env.PORT is set, it will be used instead.
  • host default 0.0.0.0 - set the hostname to use for running and listening the rendertron service. Note if process.env.HOST is set, it will be used instead.
  • width default 1000 - set the width (resolution) to be used for rendering the page.
  • height default 1000 - set the height (resolution) to be used for rendering the page.
  • cache default null - set to datastore to enable caching on Google Cloud using datastore only use if deploying to google cloud, memory to enable in-memory caching or filesystem to enable disk based caching
  • cacheConfig - an object array to specify caching options
  • renderOnly - restrict the endpoint to only service requests for certain domains. Specified as an array of strings. eg. ['http://render.only.this.domain']. This is a strict prefix match, so ensure you specify the exact protocols that will be used (eg. http, https).
  • closeBrowserdefault false - true forces the browser to close and reopen between each page render, some sites might need this to prevent URLs past the first one rendered returning null responses.

cacheConfig

  • cacheDurationMinutes default 1440 - set an expiry time in minues, defaults to 24 hours. Set to -1 to disable cache Expiration
  • cacheMaxEntries default 100 - set the maximum number of entries stored in the selected cache method. Set to -1 to allow unlimited caching. If using the datastore caching method, setting this value over 1000 may lead to degraded performance as the query to determine the size of the cache may be too slow. If you want to allow a larger cache in datastore consider setting this to -1 and managing the the size of your datastore using a method like this Deleting Entries in Bulk
  • snapshotDir default <your os's default tmp dir>/renderton - filesystem only the directory the rendertron caches will be stored in

Example

An example config file specifying a memory cache, with a 2 hour expiration, and a maximum of 50 entries

{
    "cache": "memory",
    "cacheConfig": {
        "cacheDurationMinutes": 120,
        "cacheMaxEntries": 50
    }
}