Configuring Cortex Using Configuration Files
Cortex uses a number of files for configuring various aspects of the API, like authorization and authentication. Property value changes in the Cortex configuration files are scanned and updated in the application during run time. It is not necessary to restart the server to update the values.
Default Configuration Files
Elastic Path provides default Cortex configuration files in the extensions/database/ext-data
module’s environments/default/files/conf/cortex
directory.
For development, these default configuration files need to be copied to your local file system following the instructions at Updating Configuration Files.
Configuration File Locations
Cortex scans the following directories for configuration files, reads the values, and updates them in the application.
/ep/conf/cortex
${user.home}/ep/conf/cortex
where${user.home}
is the path of your user home directory
Customizing Configuration Properties
Below is a list of the configuration files Cortex supports out of the box.
authClientHost.config
Defines the URI for the Cortex authentication endpoint. For more information on authentication endpoints, see Cortex Authentication
Property format:
mappings=["DEFAULT_HOST\=http://localhost:9080/cortex/authentication/user"]
The endpoint should be a combination of your host URI and the authentication URI, /authentication/user
.
`DEFAULT_HOST`
The DEFAULT_HOST
is the default fallback endpoint. Different scopes can have different endpoints. For example:
mappings=["DEFAULT_HOST\=http://localhost:9080/cortex/authentication/user", "telco\=http://localhost:13080/cortex/authentication/user"]
authTrustHeader.config
Defines the authentication endpoint trust header. For more information on endpoint trust headers, see Cortex Authentication
Property format:
name="x-ep-trust-header"
value="<secret trust header>"
recommendationsPageSize.config
Defines the pagination page-size setting for recommendations.
Since a large number of items may be available for recommendations, this page-size setting can limit the number of items retrieved per request.
Property format:
rest.recommendations.page.size.VALUE=I"<positive integer>"
Example with 5 items per page:
rest.recommendations.page.size.VALUE=I"5"
note
The 'I’ is required as it indicates the value is an integer.
systemReadyState.config
Defines the number of resource bundles required to register their veto before Cortex is in a ready state. During Cortex startup, resource bundles register a veto once the bundle becomes active. Before a quorum is reached, Cortex returns a 503 Service Unavailable
HTTP status for any request.
Property format:
quorumSize=I"<positive integer"
Example with 10 vetoes:
quorumSize=I"10"
oauthTokenExpiry.config
Defines the authentication token’s expiry time, in seconds. By default, the Cortex authentication tokens expire after 1 week (60 * 60 * 24 * 7
seconds).
Property format:
seconds=L"token expiry seconds"
Example with 300 seconds:
seconds=L"300"
roleHierarchy.config
Defines the role hierarchy used in Cortex authorizations. For more information on roles and permissions, see Cortex Authorization.
Property format:
roles=["ROLE_LOWEST","ROLE_HIGHER",...,"ROLE_HIGHEST"]
relosExecutorService.config
Defines thread pool size and thread idle timeout in seconds for the RelOS Executor Service. By default, the thread pool size is 500 and the thread idle timeout is 120 seconds. For more information on roles and permissions, see Cortex Authorization.
Property format:
threadPoolSize=I"<positive integer>"
threadIdleTimeout=L"idle timeout in seconds"
Example with thread pool size of 1000 and thread idle timeout of 200 seconds:
threadPoolSize=I"1000"
threadIdleTimeout=L"200"
relosOperationResultCache.config
Defines maximum number of results in cache for the RelOs OperationResult
Cache and the eviction timeout in seconds. By default, the maximum number of results in cache is 2000 and the eviction timeout is 60 seconds.
Property format:
maxResults=I"<positive integer>"
evictionTimeout=I"eviction timeout in seconds"
Example where the maximum number of results in cache is 3000 and eviction timeout is 100 seconds:
maxResults=I"3000"
evictionTimeout=I"100"