Recommended way to use Couchbase Configuration from a common place instead of config

I am using Couchbase Server 7.0.2 and .NET SDK 3.2.5. I am using appsettings keys(URL,Username,Password) to connect to couchbase cluster. In our project we have multiple applications deployed in multiple servers. It is difficult to add the couchbase details in every config file. Is there a way to get the couchbase configuration details from a common place and access it in application instead of placing it in config files.

There are many options for supplying the configuration. The first option is to supply it programmatically from some configuration store you provide. However, that’s not what I would recommend, generally speaking.

The modern .NET configuration system is very robust, and allows you to source the configuration from a variety of places. Many of the options are file-based, but not all. Environment variables, the Azure Key Vault, and AWS Systems Manager are all options provided by various NuGet packages. And probably a lot more I don’t know about.

My personal experience is using Kubernetes ConfigMaps and Secrets. These may be either mapped to environment variables on the Pod or to files mounted on the Pod and then pulled into the .NET configuration.

Here is a good starting point to read about the .NET configuration system. Configuration in .NET | Microsoft Docs