Skip to main content

Configuration

TimeBase Web Administrator is a Spring application. You can follow standard best practices to configuring Spring applications properties, such as:

Refer to Spring Documentation.

Refer to Spring Documentation.

TimeBase Web Administrator starts with the default configuration specified in the following application.yaml file:

#default configuration
server:
port: 8099
compression:
enabled: true
mime-types: text/html,text/css,application/javascript,application/json
spring:
mvc:
async:
request-timeout: 3600000 # 60 * 60 * 1000 = 1 hour
timebase:
url: dxtick://localhost:8011
readonly: false
flushPeriodMs: 500
user:
password:
streams:
include:
exclude: \#$ && \^metrics#
currencies:
tree:
group-size: 1000
grafana:
pluginsPackages:
- epam.rtc.grafana
enabled: true
streams:
include: .*
exclude:
security:
oauth2:
provider:
providerType: BUILT_IN_OAUTH # valid values: EXTERNAL_OAUTH, BUILT_IN_OAUTH, SSO
clientId: web
oauthServer: http://localhost:8099
getTokenEndpoint: /oauth/token
checkTokenEndpoint: /oauth/check
clientId: web
secret: $2a$10$1DWT60qCpc1bTJUNiV/C0u.Zw0L5Yq80OhZbsyA8LAKn7G/18q9za
authorizedGrantTypes:
- password
- refresh_token
users:
- username: admin
password: $2a$10$7M3W5JMk1wggimrbVegxWeeasqjrZUjNEiZTpMSYdId92409D2TSq
authorities: [TB_ALLOW_READ, TB_ALLOW_WRITE]
- username: reader
password: $2a$10$7M3W5JMk1wggimrbVegxWeeasqjrZUjNEiZTpMSYdId92409D2TSq
authorities: [ TB_ALLOW_READ]
- username: test
password: $2a$10$3PL6X1Gn8VjRy4r0od9NLeZrO2YWpUjzozv3jOxU0/RMjsElzPQdu
authorities: [TB_ALLOW_READ, TB_ALLOW_WRITE]
scopes:
- trust
accessTokenValiditySeconds: 300 # 5 min
refreshTokenValiditySeconds: 86400 # one day

You can override specific default configuration parameters (in this case other parameters keep their default values) or the entire default configuration to meet your specific requirements.

Additional Configuration File

You can create an additional application.yaml configuration file to override the selected configuration parameters.

For example, to override the default TimeBase URL, you can create an additional application.yaml configuration file as shown in the example below:

# additional application.yaml
timebase:
url: dxtick://localhost:8045

and run the application with -Dspring.config.additional-location system property, where you provide the path to the additional application.yaml you want to use.

# docker-compose.yaml
services:
timebase-admin:
environment:
- JAVA_OPTS=
-Dspring.config.additional-location=/path/to/the/additional/config_file/application.yaml

or add the additional configuration file using environment variable:

# docker-compose.yaml
services:
timebase-admin:
environment:
- SPRING_CONFIG_ADDITIONAL-LOCATION=/path/to/the/additional/config_file/application.yaml

System Properties

Default configuration parameters can be mapped on and overridden using Java system properties.

For example, to override the default TimeBase URL, you can add a system property as shown in the below example:

# docker-compose.yaml
services:
timebase-admin:
environment:
- JAVA_OPTS=
-Dtimebase.url=dxtick://localhost:8045

Environment Variables

Default configuration parameters can be overridden using environment variables.

Refer to Spring Naming Convention for your reference.

# docker-compose.yaml
services:
timebase-admin:
environment:
- TIMEBASE_URL=dxtick://localhost:8045

Replace the Default Configuration

You can ignore the default configuration and entirely replace it by the custom application.yaml. In this case, run the application with -Dspring.config.location system property and provide the path to the new application.yaml you want to use instead of the default one.

Be aware, that in this case, you will have to create the entire config from scratch, which is significantly more resourceful than redefining the selected parameters - described in the above sections.

# docker-compose.yaml
services:
timebase-admin:
environment:
- JAVA_OPTS=
-Dspring.config.location=/path/to/the/config_file/application.yaml

Examples

Override TimeBase connection parameters in the additional application.yaml file:

# additional application.yaml
timebase:
url: dxtick://localhost:8045
user: admin
password: admin

Configure users by adding an additional application.yaml:

# additional application.yaml
security:
oauth2:
users:
- username: admin
password: admin # or BCrypt encoded password
authorities: [TB_ALLOW_READ, TB_ALLOW_WRITE]

Configure ORY Hydra SSO provider in the additional application.yaml:

# additional application.yaml
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: http://hydra-url:8011/my-client-id

security:
oauth2:
provider:
providerType: SSO
name: hydra
clientId: my-hydra-client-id
validateIssuer: false
userInfo:
enable: true

Configure users via Java system properties:

# docker-compose.yaml
services:
timebase-admin:
environment:
- JAVA_OPTS=
-Dsecurity.oauth2.users.0.username=admin
-Dsecurity.oauth2.users.0.password=admin
-Dsecurity.oauth2.users.0.authorities="TB_ALLOW_READ, TB_ALLOW_WRITE"

Configure API Keys via environment variables:

# docker-compose.yaml
services:
timebase-admin:
environment:
- SECURITY_AUTHORIZATION_SOURCE=CONFIG
- SECURITY_API-KEYS_SESSIONS_ENABLED=false
- SECURITY_API-KEYS-PROVIDER_API-KEYS_0_NAME=TEST_API_KEY
- SECURITY_API-KEYS-PROVIDER_API-KEYS_0_KEY=TEST_API_SECRET
- SECURITY_API-KEYS-PROVIDER_API-KEYS_0_USER=admin
- SECURITY_API-KEYS-PROVIDER_API-KEYS_0_AUTHORITIES=TB_ALLOW_READ, TB_ALLOW_WRITE