Skip to content

Builtin Dynocon sources

Eugene Strokin edited this page Apr 30, 2021 · 1 revision

There are four out of the box sources for the properties:

  • env - environment variables
  • sys - system variables
  • poll-sys - polling system variables
  • poll-urls - polling URLs

The sources are set using dynocon.sources parameter:

dynocon.sources=env,sys,dynamodb

Default value is: env,sys,poll-urls.

Static sources:

env and sys providing properties from environment and system varriables. They are not dynamic, the values are retrieved from the corresponding variables at the start-up time. The names of the properties will be the same as the names of the variables.

Example:

export my.property.abc="value xyz"
public static final Property<String> MY_PROP_ABC = new Property<>("my.property.abc", String.class).ifNull("my default value");

Dynamic sources:

poll-sys and poll-urls are dynamic properties, the values could change during runtime.

Additional configuration for poll-sys:

dynocon.system.delay - delay in seconds the system properties are checked and the properties are updated if the values are changed. Default is a 1-second delay.

Additional configuration for poll-urls:

dynocon.urls - comma-separated URLs the properties are retireaved from. Could be file:/ or https://. Default value is: file:/opt/service.json.

Example:

export dynocon.urls=file:/opt/my-properties.properties,https://myserver.com/my-remote-propeerties.json

The properties with the same name from the later URL will override the values from the previous URLs.

dynocon.url.delay - delay in seconds the URLs are called and the values of the properties are updated if changed. Default is 10 seconds.

Custom sources

Custom sources could be injected into Dynocon. See DynamoDB source example.