Skip to content

Improving AppSettings Processing

Steve Ives edited this page Dec 21, 2021 · 14 revisions

The Harmony Core SolutionTemplates include code and sample configuration files for a mechanism that allows environment variables that are required at runtime to be specified via the special appsettings.json file. This mechanism is described in detail in the Environment Variables documentation.

Earlier versions of the solution templates contained code that did not operate as intended, and this document contains instructions on how to alter the supplied code to provide a fully working solution.

Determining If The Fix is Required

To determine if your code needs this fix to be applied, look in your Services.Data project directory and edit the file called AppSettings.dbl. If you look towards the end of that file and find a class named EnvironmentVatiable that looks like this:

    ;;; <summary>
    ;;; Represents a aingle environment variable.
    ;;; </summary>
    public class AppEnvironmentVariable

        ;;; <summary>
        ;;; The name of the environment variable.
        ;;; </summary>
        public readwrite property Name, string

        ;;; <summary>
        ;;; The value of the environment variable.
        ;;; </summary>
        public readwrite property Value, string

    endclass

Then your code needs updating. If the class is not present then your code has already been fixed.

Applying the Fix

Clone this wiki locally