---
title: BolMiddleware configuration settings
summary: Configuration keys consumed by BolMiddleware, retrieval methods, and runtime dependencies.
status: draft
owner: SAIF IT Core Services
last_reviewed: 2026-10-12
library: BolMiddleware
reference_type: package
---

# BolMiddleware configuration settings

BolMiddleware reads two environment API keys through `IEnvironmentClient` and a small set of `IConfiguration` keys, and it reads the hosting environment name. It has no database connections, no secure settings, and no developer override files. The settings below were identified in source; settings read inside referenced client packages are listed as transitive and are unknown** unless stated.

## Configuration retrieval methods
| Method | Class / Interface | Namespace | Usage pattern |
| --- | --- | --- | --- |
| `GetSettingValue` | `IEnvironmentClient` | `SAIF.NetCore.Services.Contracts` (transitive through `SAIF.NetCore.ServiceExtensions`)* | `UseSessionCookie` is read on each session id lookup in `BolContextModel.GetSessionId`; `SessionCookieName` is read there only when `UseSessionCookie` is true, and separately in the middleware session cookie helper. |
| `GetRequiredValue` | `IConfiguration` extension | `SAIF.NetCore.Common` | Read the root `ApplicationName` in `BolContextModel`. |
| `Configure<T>(section)` | `IServiceCollection` | `Microsoft.Extensions.DependencyInjection` | Bind the `BasicAppMap` section in `BolRazorLayoutStartup`. |
| `EnvironmentName` | `IWebHostEnvironment` | `Microsoft.AspNetCore.Hosting` | Checked for the text `prod` in `_BolPageHeaderPartial`. |

## Environment API settings
Settings retrieved via `IEnvironmentClient`.

| Setting key | Method | Data type | Purpose | Consuming class | Source |
| --- | --- | --- | --- | --- | --- |
| `bolmiddleware:UseSessionCookie` | `GetSettingValue` | bool | When true, the session id for context lookups comes from a named cookie instead of the ASP.NET Core session ([BR-BOLMIDDLEWARE-020](business-rules.md#br-bolmiddleware-020-session-identifier-source-selection)). Read on every request; behavior when the key is missing is unknown**. | `BolContextModel` | src/BolMiddleware/Models/BolContextModel.cs |
| `bolmiddleware:SessionCookieName` | `GetSettingValue` | string | Name of the cookie holding the session id; read when `UseSessionCookie` is true and when the middleware session cookie is added for a new context. | `BolContextModel` | src/BolMiddleware/Models/BolContextModel.cs |

## appsettings.json and IConfiguration
Settings read through `IConfiguration` (`appsettings.json`, `appsettings.<Environment>.json`, environment variables, and any other configured provider).

| Setting key | Required | Default value | Retrieval | Purpose | Consuming class | Source |
| --- | --- | --- | --- | --- | --- | --- |
| `ApplicationName` | Yes | — | `GetRequiredValue` | Name of the consuming BOL application, used as the current application when saving and resolving context. The consumer sample places the value under `AppSettings`, so a mismatch with this root key is possible**. | `BolContextModel` | src/BolMiddleware/Models/BolContextModel.cs |
| `BasicAppMap:ApplicationName` | No | empty string | `Configure<BasicAppMap>` | Application name used by the menu views. | `BasicAppMap` | src/BolMiddleware/BolRazorLayoutStartup.cs |
| `BasicAppMap:AppMenuCategory` | No | empty string | `Configure<BasicAppMap>` | Menu category code used to filter the top menu items. | `BasicAppMap` | src/BolMiddleware/BolRazorLayoutStartup.cs |
| `BasicAppMap:PageIds` | No | empty dictionary | `Configure<BasicAppMap>` | Page identifier map used to mark the current menu item; the `HomePage` entry is the fallback when the request path is empty. | `BasicAppMap` | src/BolMiddleware/Pages/Shared/_BolMenuItemPartial.cshtml |

## Environment variables
This library reads no environment variables directly.

## Transitive configuration (from dependencies)
Settings required at runtime by referenced packages, not directly consumed by this library's code.

| Setting key | Method | Source dependency | Dependency type | Purpose |
| --- | --- | --- | --- | --- |
| `AppSettings:ApplicationHost`, `AppSettings:ApplicationName` | `IConfiguration` | `SAIF.NetCore.ServiceExtensions` | NuGet | Application host and name used by the platform startup*. |
| `ASPNETCORE_HOST_LOCATION`, `ASPNETCORE_REDIRECT_SSL` | Environment variable | `SAIF.NetCore.ServiceExtensions` | NuGet | Host location and SSL redirect used by the platform startup*. |
| OIDC settings | `IConfiguration` | `SAIF.NetCore.ServiceExtensions` | NuGet | Sign-in settings required by `OidcRazorStartup**`. |
| API base URLs | `IEnvironmentClient` | `BolContextApi.Client`, `BolMenuApi.Client`, `PolicyHeaderApi.Client`, `PolicyCoreApiClient` | NuGet | Endpoints of the four remote APIs**. |

## Cookie and session keys
These are not configuration but are fixed storage names the library uses.

| Name | Store | Purpose |
| --- | --- | --- |
| `BolContext` | Cookie | Short-lived serialized `ContextCookie`, ten second lifetime. |
| `WebContextKey` | Session | Serialized web context. |
| `WebContextId` | Session and form value | Context identifier. |
| `BolMenu` | Session | Cached menu. |
| `BolPolicyHeader` | Session | Cached policy header. |
| `cid` | Query string | Context identifier passed during navigation. |
| `WebContextSaveKey` | None | Defined but unused. |

## Configuration dependencies
| Dependency | Type | Required at | Impact if missing |
| --- | --- | --- | --- |
| `ApplicationName` key | `IConfiguration` value | request | `GetRequiredValue` throws and the page fails. |
| `IEnvironmentClient` | service | request | Session id source cannot be selected; resolution fails because the service is not registered by this library**. |
| `UseSession()` middleware and distributed cache | middleware | startup | Session reads fail; this library calls `AddSession()` only. |
| Hard-coded account hosts | constants in view | request | The profile and logoff links use fixed `account.saif.com` and `account-qa.saif.com` hosts. |

## Notes
- Both environment keys are read on every request instead of once at startup, adding an environment service call to each page.
- The `prod` environment test matches any name containing the text, such as `preprod`.

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Security and authorization](security-authorization.md)
- [Service registration](service-registration.md)
- [API reference](api/index.md)

## Sources
- src/BolMiddleware/Models/BolContextModel.cs
- src/BolMiddleware/BolRazorLayoutStartup.cs
- src/BolMiddleware/Models/MenuModels/BasicAppMap.cs
- src/BolMiddleware/Contracts/Constants.cs
- src/BolMiddleware/Pages/Shared/_BolPageHeaderPartial.cshtml
- src/BolMiddleware/Pages/Shared/_BolMenuItemPartial.cshtml
