Skip to main content
Open

Create Docker container with disabled background operations

Related products:Indicium Service Tier
  • February 26, 2025
  • 3 replies
  • 49 views

When pulling and running a new Indicium container in Docker it immediately attempts to run scheduled systemflows which isn’t always desirable. To prevent this from happening I’d like to see a new environment variable to disable the agent before the container runs for the first time.

Did this topic help you find an answer to your question?

3 replies

  • 18 replies
  • February 27, 2025

Hi ​@Roland in the future, we want to make more environment variables available in the Indicium container image. This is definitely a good addition.

As for now, it is already possible through the CUSTOM_JSON variable.

For example, to disable the agent, you can simply add -e CUSTOM_JSON='{"Agent":{"Enabled":false}}' to the run command.

The extra JSON body specified in this variable will be merged with the already existing configuration from all other variables.


Forum|alt.badge.img+1

Just to give a bit more insight in how Indicium loads settings, it is built using ASP .NET Core and thus also uses the configuration mechanism that comes with it.

So besides the appsettings.json file it also reads configuration from several other sources, one of which being environment variables themselves.

Environment variables are actually given more precedence than what is configured in appsettings.json so when using “docker run” you can also specify -e Agent__Enabled=false in this case.

Which would then overwrite the Agent:Enabled setting that is specified in appsettings.json within the container, even when CUSTOM_JSON has been applied since that modifies the appsettings.json file during startup.

One of the links above explains why you need to use double underscores as a key separator instead of :  when using environment variables but to go slightly deeper take the following dummy config:

{
  "ExampleSetting": "Example value",
  "NestedExampleSettingLevel0": {
    "NestedExampleSettingLevel1" : {
      "ExampleSetting": 10,
      "OtherExampleSetting": false
    }
  },
  "ExampleArraySetting": [
    "value1",
    "value2"
  ]
}

In code this gets converted to the following key and value pairs:

ExampleSetting = Example value
NestedExampleSettingLevel0:NestedExampleSettingLevel1:ExampleSetting = 10
NestedExampleSettingLevel0:NestedExampleSettingLevel1:OtherExampleSetting = false
ExampleArraySetting:0 = value1
ExampleArraySetting:1 = value2

So knowing this you can basically specify any appsetting you normally would through environment variables as well by replacing “:” with “__”:

ExampleSetting=Example value
NestedExampleSettingLevel0__NestedExampleSettingLevel1__ExampleSetting=10
NestedExampleSettingLevel0__NestedExampleSettingLevel1__OtherExampleSetting=false
ExampleArraySetting__0=value1
ExampleArraySetting__1=value2

And thus you can overwrite any setting Indicium might use from appsettings by using the matching keys in for example an env file.


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9
NewOpen

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings