Configuring environment settings

Environment settings were previously referred to as environment variables.

Tonic Structural uses environment settings for many of its configuration options. For example, the ENABLE_LOG_COLLECTION environment setting determines whether you share logs with Tonic.ai.

Structural also uses environment settings to enable custom generators and pre-release features for customers.

About configuring environment settings

Options for configuring an environment setting

You can configure selected environment settings from the Environment Settings tab of Tonic Settings. For these selected settings, you can also use the Structural API to configure them.

You configure other environment settings in a .yaml file.

  • For Kubernetes deployments, the file is values.yaml.

  • For Docker deployments, the file is docker-compose.yaml.

Configuring an environment setting in the correct service

Each environment setting is tied to a specific service. Most environment settings are used by either the Structural web server or the worker.

The .yaml files contain a section for each service. Within each section is a subsection for the environment settings for that service.

You add each environment setting to the environment settings for the appropriate service.

When you configure an environment setting from Tonic Settings or using the Structural API, Structural automatically uses the new value. You do not need to specify a service.

Restarting after a configuration change

When you change an environment setting, the change does not take effect until the services are restarted.

When you configure an environment setting from Tonic Settings or using the Structural API, Structural automatically uses the new value. You do not need to restart any services.

Configuring environment settings from Tonic Settings

Required global permission: Manage environment settings

The Environment Settings tab on Tonic Settings allows you to configure some of the more commonly used environment settings. Some settings are always displayed in the list. Others you can add to the list manually when you need to set them.

When you configure a setting value from Tonic Settings, it overrides any configuration of that setting in the .yaml file.

Information in the Environment Settings list

For each setting, the Environment Settings list includes:

  • The name of the environment setting. The name is the setting identifier updated to use title case instead of all caps, and to replace underscores with spaces.

  • The identifier used in the .yaml file for that setting.

  • A description of the setting and how it is used.

  • The default value.

    • If you configured a value for the setting in the .yaml file, then this is that value.

    • If you did not configure a value in the .yaml file, then this is the Structural default value.

Filtering and sorting the Environment Settings list

To filter the list, in the filter field, begin to type the setting identifier or value. As you type, the list is filtered to only display matching settings.

You can use the Name column to sort the list. To sort the list, click the column heading. To reverse the sort order, click the column heading again.

Adding a setting manually

In addition to the settings that are always displayed, there are settings that you can add to the list manually if you need to configure them.

From the Environment Settings tab, to add a setting manually:

  1. Click Add New Setting.

  2. On the Add Environment Setting panel, in the Setting Name field, enter the name of the setting.

  3. After you specify the setting name, under Setting Value, Structural displays the appropriate field to provide the setting value. For example, for a boolean value, a toggle displays. For a text value, a field displays.

  4. After you provide the value, to save the setting to the list, click Save.

After you add the setting to the list, you can update the value in the same way as settings that are permanently in the list.

Setting a new value

To provide a new value for a setting:

  1. Click the Edit option for the setting.

  2. Provide the new value: For a numeric value, in the field, type the new value. For a boolean value, use the toggle. When the toggle is in the on position, the value is true.

  3. Click Save.

Restoring the default value

The value displayed in the Default Value column is either:

  • If a value is configured in the .yaml file, then it is that value.

  • If a value is not configured in the .yaml file, then it is the Structural default value.

To reset the setting to the value in Default Value:

  1. Click Edit for the setting.

  2. Click the Restore option next to the default value.

Configuring environment settings from a .yaml file

Updating in Kubernetes

For Kubernetes, in values.yaml, the service sections (web_server and worker) are under tonicai. Within those sections, the environment settings are under env.

tonicai:
  web_server:
    env: {
      "ENVIRONMENT_SETTING_NAME": "Setting value"
    }

You add the environment setting to the appropriate env section, based on the service that that variable is associated with. For example:

env: {
    "TONIC_SSO_AUTHORIZATION_SERVER_ID": "12345",
    "TONIC_SSO_PROVIDER": "google"
}

After you update the yaml file, to restart the service and complete the update, run:

$ helm upgrade <name_of_release> -n <namespace_name> <path-to-helm-chart>

The above helm upgrade command is always safe to use when you provide specific version numbers. However, if you use the latest tag, it might result in Structural containers that have different versions.

If this occurs, you can run the Structural update process to ensure that all of the containers are updated and synchronized on the latest Structural version.

Alternatively, you can:

  • Delete each deployment (kubectl delete pod …), or scale the deployment replicas to 0 and then back to 1. This ensures that all pods restart with the latest version.

  • Use helm to uninstall and re-install Structural.

Remember that if an environment setting is configured on Tonic Settings or using the Structural API, then that configuration takes precedence over any configuration in the .yaml file.

Updating in Docker

For Docker, in docker-compose.yaml, the service sections (tonic_web_server and tonic_worker) are under services. Within those sections, the environment settings are under environment.

tonic_web_server:
  environment:
    ENVIRONMENT_SETTING_NAME: Setting value

If your Structural instance is deployed using Docker, then you can either:

  • Set the value directly in docker-compose.yaml.

  • Set the value in your .env file, and add a reference to the variable in docker-compose.yaml.

To set the value directly in docker-compose.yaml, add the setting and value to the appropriate environment section, based on the service that the setting is associated with. For example:

environment:
  TONIC_SSO_AUTHORIZATION_SERVER_ID: 12345
  TONIC_SSO_PROVIDER: google

If you set the value in .env, then to add the reference in docker-compose.yaml:

environment:
  TONIC_SSO_AUTHORIZATION_SERVER_ID: ${TONIC_SSO_AUTHORIZATION_SERVER_ID}
  TONIC_SSO_PROVIDER: ${TONIC_SSO_PROVIDER}

After you update the yaml file, to restart the service and complete the update:

$ docker-compose down
$ docker-compose pull && docker-compose up -d

Remember that if an environment setting is configured on Tonic Settings or using the Structural API, then that configuration takes precedence over any configuration in the .yaml file.

Last updated