Configuration

SCR can source its configuration from a file or from environment variables.

Service configuration structure

The recommended configuration format is YAML. The below sections describe the officially supported configuration options that influence various aspects of the service functionality. The service may support options other than the ones listed below, but those are not a part of the public API and may be changed or deleted at any time.

General service configuration

SCR uses a standard Spring Boot server.port property to configure the port to expose the REST API at.

server:
  port: <unsigned short integer>  # Server port used to expose the REST API at

Spring Cloud Config Server

SCR implementation is based on Spring Cloud Config Server. Refer to the corresponding documentation for the list of supported configuration options.

Known issues: Spring Cloud Config Server sends old configuration

You may notice that after you updated your SCR repository branch, SCR sends an outdated version of the configuration in response to the client. Sometimes creating a new branch is the only way to get the updated configuration version. This happens due to interruptions in the connection to the Git repository. Spring Cloud Config server pulls the whole branch during each request, so when the connection is unavailable, SCR will send the configuration pulled during the last successful request.

Kaa developers proposed to handle Git connection issues for Spring Cloud Config Server. See also this Kaa Jira ticket.

Until all necessary fixes are made, use the workaround below to tackle this issue.

Workaround: change configuration fetch time

Kaa’s Spring Cloud Config Client applications (KPC, DCX, etc.) automatically fetch configurations from SCR. Default period for each configuration fetch is 300000 milliseconds (5 minutes).

You can configure the time period for configuration fetch by adding a time-to-live property in milliseconds:

  1. Open src/main/resources/application.yml configuration file.
  2. Specify the time-to-live property in milliseconds:
    health:
      config:
        time-to-live: 60000
    

NATS

The below parameters configure SCR’s connection to NATS.

NOTE For security reasons, NATS username and password are sourced from the environment variables.

nats:
  urls: <comma separated list of URL>  # NATS connection URLs

Management

SCR monitoring and management implementation is based on the Spring Boot Actuator. Refer to the corresponding documentation for the list of supported configuration options.

Logging

By default, SCR uses Spring Boot logging configuration with logback for logging. Refer to the corresponding documentation for the list of supported configuration options.

Built-in configuration profiles

For your convenience, SCR comes with a default built-in configuration profile.

Built-in profiles are optimized for a Kubernetes-based production deployment. They do not define any Kaa applications—you have to configure them for a specific Kaa-based solution.

Default

NOTE Some of the configuration options under spring.cloud.config.server.git are sourced from the environment variables. To set them, you can use environment variables or override the options in your configuration file.

server:
  port: 80

nats:
  urls: nats://nats:4222

spring:
  cloud:
    bus:
      enabled: true
    config:
      server:
        git:
          uri: ${git.uri}
          default-label: ${git.branch:master}
          clone-on-start: true
          search-paths: ${git.search.paths:""}

management:
  port: 8080
  security:
    enabled: false

endpoints:
  enabled: false
  health:
    enabled: true
    mapping.UNKNOWN: SERVICE_UNAVAILABLE
  info.enabled: true
  metrics.enabled: true