Engine’s Configuration Overrides
Crafter Engine comes with pre-configured settings that you may want to override. To view the pre-configured settings in Crafter Engine, in your installation, go to CRAFTER_HOME/bin/apache-tomcat/webapps/ROOT/WEB-INF/classes/crafter/engine
and open the file server-config.properties
.
To override any of the pre-configured settings, in your installation, go to CRAFTER_HOME/bin/apache-tomcat/shared/classes/crafter/engine/extension
and add the settings you would like to configure in the file server-config.properties
. The override file have some settings already listed that you may want to override in Crafter Engine:
Properties
The following allows you to configure the following:
crafter.engine.site.default.rootFolder.path
allows you to set the content root foldercrafter.engine.elasticsearch.timeout.connect
,crafter.engine.elasticsearch.timeout.socket
andcrafter.engine.elasticsearch.threads
allows you to configure the Elasticsearch client connection timeout, socket timeout and number of threads
1# Content root folder. The {siteName} variable will be automatically replaced.
2crafter.engine.site.default.rootFolder.path=file:${CRAFTER_DATA_DIR}/repos/sites/{siteName}/sandbox/
3# The URL of Crafter Search
4crafter.engine.search.server.url=${SEARCH_URL}
5# The value for the access token for Crafter Search
6crafter.engine.search.server.accessToken.value=${SEARCH_ACCESS_TOKEN}
7# The URL of Crafter Profile
8crafter.profile.rest.client.url.base=${PROFILE_URL}
9# If the Security Provider is enabled
10crafter.security.enabled=true
11# The Elasticsearch hosts to use
12crafter.engine.elasticsearch.urls=${ES_URL}
13# The username for Elasticsearch
14crafter.engine.elasticsearch.username=${ES_USERNAME}
15# The password for Elasticsearch
16crafter.engine.elasticsearch.password=${ES_PASSWORD}
17# The connection timeout in milliseconds, if set to -1 the default will be used
18crafter.engine.elasticsearch.timeout.connect=-1
19# The socket timeout in milliseconds, if set to -1 the default will be used
20crafter.engine.elasticsearch.timeout.socket=-1
21# The number of threads to use, if set to -1 the default will be used
22crafter.engine.elasticsearch.threads=-1
23# Indicates if keep alive should be enabled for sockets used by the search client, defaults to false
24crafter.engine.elasticsearch.keepAlive=false
25
26# Engine management authorization token
27crafter.engine.management.authorizationToken=${ENGINE_MANAGEMENT_TOKEN}
28
29# The key used for encryption of configuration properties
30crafter.security.encryption.key=${CRAFTER_ENCRYPTION_KEY}
31# The salt used for encryption of configuration properties
32crafter.security.encryption.salt=${CRAFTER_ENCRYPTION_SALT}
33
34# The prefix used for all header names
35crafter.security.header.names.prefix=CRAFTER_
36# The name of the header containing the username
37crafter.security.header.names.username=username
38# The name of the header containing the email
39crafter.security.header.names.email=email
40# The name of the header containing the groups
41crafter.security.header.names.groups=groups
42# The name of the header containing the token
43crafter.security.header.names.token=secure_key
44
45# The current environment the Engine instance is running in (e.g. default, dev, qa, prod)
46crafter.engine.environment=${CRAFTER_ENVIRONMENT}
Forwarded Headers
The following section allows you to configure forwarded headers to resolve the actual hostname and protocol when it is behind a load balancer or reverse proxy. Forwarded headers are disabled by default.
1# Indicates if Forwarded or X-Forwarded headers should be used when resolving the client-originated protocol and
2# address. Enable when Engine is behind a reverse proxy or load balancer that sends these
3crafter.engine.forwarded.headers.enabled=false
Content-Length Headers
The following allows you to configure the content-length header sent for responses. The content-length header is sent for all responses by default.
1# Indicates if the 'etag' header should be added
2crafter.engine.header.etag.enable=false
3# Indicates the urls that will have the 'etag' header (comma separated ant matchers)
4crafter.engine.header.etag.include.urls=/**
Spring Expression Language
The following allows you to configure SpEL expressions for custom app contexts. SpEL expressions support is disabled by default.
1# Indicates if the custom site application contexts should support SpEL expressions
2crafter.engine.context.expressions.enable=false
3# Indicates if the whole servlet & spring context should be available for templates & scripts
4crafter.engine.disableVariableRestrictions=false
5# Patterns for beans that should always be accessible from the site application context
6crafter.engine.defaultPublicBeans=crafter\\.(targetIdManager|targetedUrlStrategy)
Groovy Sandbox Configuration
The following allows you to configure the Groovy sandbox. The Groovy sandbox is enabled by default.
1# Indicates if the sandbox should be enabled for all sites
2crafter.engine.groovy.sandbox.enable=true
3# Indicates if the blacklist should be enabled for all sites (this will have no effect if the sandbox is disabled)
4crafter.engine.groovy.sandbox.blacklist.enable=true
5# The location of the default blacklist to use for all sites (this will have no effect if the sandbox is disabled)
6crafter.engine.groovy.sandbox.blacklist.path=classpath:crafter/engine/groovy/blacklist
For more information on configuring the Groovy sandbox, see here
Static Methods in Freemarker Templates
The following allows you to configure access to static methods in Freemarker templates. Access to static methods in Freemarker templates is disabled by default.
1# Indicates if access for static methods should be allowed in Freemarker templates
2crafter.engine.freemarker.statics.enable=false
Cache
Max Items
The following allows you to configure the maximum number of objects in Engine’s cache:
# The max number of items that each site cache can have
crafter.engine.site.default.cache.maxAllowedItems=250000
URL Transformations
The following allows you to configure whether the URL transformation performed by the view resolver will be cached:
# Flag that indicates if the URL transformations performed by the view resolver should be cached
crafter.engine.page.view.resolver.url.transformation.cache=false
Preloaded Folders
The following allows you to configure folders to be preloaded in the cache:
#################
# Cache Warm Up #
#################
# Indicates if cache warming should be enabled. This means the site cache will be warmed up (according to a list of
# cache warmers) on context init and instead of cache clear, a new cache will be warmed up and switched with the
# current one
crafter.engine.site.cache.warmUp.enabled=false
# The descriptor folders that need to be preloaded in cache, separated by comma. Specify the preload depth with
# :{depth} after the path. If no depth is specified, the folders will be fully preloaded.
crafter.engine.site.cache.warmUp.descriptor.folders=/site:4
# The content folders that need to be preloaded in cache, separated by comma. Specify the preload depth with
# :{depth} after the path. If no depth is specified, the folders will be fully preloaded.
crafter.engine.site.cache.warmUp.content.folders=/scripts,/templates
where:
The descriptor folders are paths that contain XML that needs to be parsed, loaded and merged e.g. for inheritance. Most of the time this would be folders under
/site
The content folders are mostly static, non-processed content, e.g. scripts, templates, static-assets
For all projects, the cache is preloaded using the above configuration. CrafterCMS warms up the cache on every publish and startup. Note also that what’s cache warmed will be warmed on every publish and startup and will live as long as nothing kicks it out of the cache due to least recently used (LRU) cache.