Skip to content

Load a configuration section

This operation retrieves one named section from the Environment API and merges its settings into the library's shared cache. It exists as the fallback path for the common case where a non-global key was not requested at construction time and therefore is not yet part of the main payload.

Field Value
Operation ID OP-ENV-003
Trigger GetConfigSettingInfo misses a non-global key in the shared cache
Inputs section
Outputs Section-scoped ConfigurationSettings payload plus merged cached entries
Primary components EnvironmentServiceBase.LoadSection, EnvironmentServiceBase.AddSettingToLoadedConfigurations
Entry point SAIF.Framework.Security.EnvironmentApi\Services.Common\EnvironmentServiceBase.cs

Steps

  1. Read the current LastRefreshed value before issuing the section request, so the returned payload can be stamped with the same server refresh timestamp as the rest of the cache (BR-002).
  2. Build /v2/settings/{ApplicationId}/{ApplicationHost}/{section}/section and download the JSON response.
  3. Deserialize the response into a fresh ConfigurationSettings instance.
  4. Stamp the returned payload with the previously captured LastRefreshed value and a new local LastLoaded timestamp.
  5. Merge each returned ConfigSetting into the shared cache by calling AddSettingToLoadedConfigurations.
  6. Lock _configLock during the merge so concurrent section loads cannot corrupt the shared dictionary.
  7. Skip the merge entirely when _configurations is still null.
  8. Ignore duplicate-key ArgumentExceptions so a repeated or concurrent section load does not fail the caller.
  9. Return the section payload to the caller, which rechecks the specific key against the freshly merged settings.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller misses non-global key]) --> Stamp[Capture LastRefreshed]
    Stamp --> Download[Download section payload]
    Download --> Deserialize[Deserialize ConfigurationSettings]
    Deserialize --> Merge[Merge returned settings into shared cache]
    Merge --> End([Return section payload])

Failure and edge-case behavior

  • The method depends on the current ApplicationHost; a host-resolution failure surfaces before the section request is even made.
  • Duplicate section entries are ignored during the cache merge rather than overwriting the value that was already loaded.
  • HTTP and deserialization failures are not caught locally and propagate to the caller.

Sources

  • SAIF.Framework.Security.EnvironmentApi\Services.Common\EnvironmentServiceBase.cs