> For the complete documentation index, see [llms.txt](https://comunity.gitbook.io/learning.comunitynexus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://comunity.gitbook.io/learning.comunitynexus/getting-started/manage-your-project/deploy/configuration.md).

# Configuration

Manage your project's Config Hub settings, stage changes in the Development environment, and deploy them to QA and Production.

Configuration holds your application's settings for each environment, such as its name, base URL and service endpoints. The settings are stored in Config Hub, and your application reads them at run time.

Changes to configuration settings are staged rather than applied directly. You edit settings in the Development environment, and a change reaches an environment only when the configuration is deployed to it. This releases a set of setting changes in one step and avoids editing live values directly.

Configuration covers your application's general settings. Communication settings are also stored in Config Hub, but they are not staged in this way; see [Communication Settings](/learning.comunitynexus/guides/communications/communication-settings.md). Function app and report settings are not part of Configuration.

## Staging and live values

Each setting has a staging value and a live value in each environment.

| Value             | Meaning                                                                                   |
| ----------------- | ----------------------------------------------------------------------------------------- |
| **Staging value** | The value saved in Nexus, waiting to be deployed.                                         |
| **Live value**    | The value currently held in Config Hub for that environment, which your application uses. |

Saving a change stores it as a staging value; Config Hub is not updated until the configuration is deployed. The QA environment and Production environment tabs show live values, and a toggle switches the view to staging values. A setting marked **Missing value** has no live value in that environment yet, because it has not been deployed there.

## Open Configuration

1. Open your project and select **Project Settings** (cog icon). See [Project Settings](/learning.comunitynexus/getting-started/manage-your-project/settings.md).
2. Select an environment tab: **Development environment**, **QA environment** or **Production environment**.
3. Select **Configuration**.

The **Configuration Settings** table lists each setting with its **Setting name**, **Apply globally** switch, **Environment value** and **Secrecy** shield. Use **View** and the sort dropdown to filter and order the list, and the search box to find a setting.

<figure><img src="https://2119497243-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuDohsdjh9uGvRmWIuzMX%2Fuploads%2Fgit-blob-5c13de3948cf64831f19a0e1f369552788e21a45%2Fimage.png?alt=media" alt=""><figcaption><p>Configuration settings in the Development environment</p></figcaption></figure>

## Edit settings

Settings can be edited only in the **Development environment** tab. The QA and Production tabs are for reviewing values.

### Change a value

1. In the **Development environment** tab, select **Configuration**.
2. Edit the setting's **Environment value**.
3. Save your changes.

The new value is staged, and reaches each environment the next time the configuration is deployed there.

### Add a setting

Select **Add a configuration setting** below the table and complete the new setting. A new setting takes the same value in every environment by default.

### Apply the same value to all environments

When **Apply globally** is on, the setting uses the same value in Development, QA and Production. Turn it off to give environments different values.

### Keep a value private

Select the shield in the **Secrecy** column to make a setting private or public. Private values are encrypted and stored in [Azure Key Vault](https://azure.microsoft.com/en-us/products/key-vault). Public values remain visible in the table.

### Delete a setting

1. Hover over the setting row and select the trash can icon that appears on the right.
2. Confirm the deletion.

What happens next depends on whether the setting has been deployed:

| Setting          | Result                                                                                   |
| ---------------- | ---------------------------------------------------------------------------------------- |
| Not yet deployed | Removed immediately. Use this to correct a setting added with the wrong name.            |
| Deployed         | Removed from Config Hub at the next deployment. Until then, the setting can be restored. |

## Deploy configuration changes

Staged changes reach an environment through a deployment. Configuration is included in every full deployment, and can be deployed on its own as a partial deployment by selecting only **Configuration**. See [Manual Project Deployment Across Environments](/learning.comunitynexus/getting-started/manage-your-project/deploy/manual-project-deployment-across-environments.md#partial-deployment).

Settings are not copied from one environment to another, because values usually differ between environments. Each deployment applies the values staged for its target environment. After deploying, open the environment's tab to confirm the live values.

## Use settings in your code

Your application reads a setting from Config Hub by its name:

```csharp
// To invoke an application setting in your code:
Config.{{Application Setting}}
// A real life example referencing FaultEmail application setting
Config.FaultEmail()
```

## System-generated settings

New projects include the following settings.

| Setting                       | Purpose                                                                         |
| ----------------------------- | ------------------------------------------------------------------------------- |
| **AppName**                   | The name that identifies your application.                                      |
| **BaseUrl**                   | The base URL of your application, used as the starting point for relative URLs. |
| **ComsApi**                   | The API endpoint of the communication service.                                  |
| **ComsService**               | The URL of the communication service the application uses.                      |
| **ComsServicePassword**       | The password or secret used to authenticate with the communication service.     |
| **ComsServiceUsername**       | The username used to authenticate with the communication service.               |
| **MediaServerUploadUrl**      | The endpoint of the media server that uploads and stores media files.           |
| **ObservabilityTraceHttpUrl** | The endpoint that receives your application's traces.                           |
| **PublishedAppName**          | The application name shown to end users.                                        |
| **WelcomeMessage**            | The message shown to users when they first use the application.                 |
