Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

Environment Config Sample

Demo showing how to do environment specific configuration in .Net Core

Introduction

In the EnvironmentConfig/Config folder are three files:

  • appsettings.json
  • appsettings.Staging.CA.json
  • appsettings.Staging.UK.json

The ConfigurationLoader class is set up using the new ConfigurationBuilder logic in .Net Core to load these files based on the programs arguments.

The appsettings.json is the default, whilst any keys present in the overrides like appsettings.Staging.CA.json will overwrite the defaults for us.

The arguments specifying which environment and tenant we are in are passed to the program, e.g:

dotnet run Staging CA

Prerequisites

Setup

Run the following in the EnvironmentConfig project folder:

dotnet restore
dotnet build

Running The Application

Run the following in the EnvironmentConfig project folder.

To use the default appsettings.json config with no environment or tenant overrides, use:

dotnet run

To pass in the environment and tenant to override the default configuration, use:

dotnet run Staging CA

About

Demo showing how to do environment specific configuration in .Net Core

Resources

License

Releases

No releases published

Packages

No packages published

Languages