Giter Club home page Giter Club logo

activeprofileconfigurationextension's Introduction

About

This library can be used to add an extension method to IConfigurationBuilder to generate configuration object from Json files on the basis on active profiles set in environment variable APPLICATION_ACTIVE_PROFILES.

Usage

Setup

  • Install the nuget package by following the steps given at nuget package ActiveProfileJsonConfiguration in your dotnet core application.
  • Set the environment variable APPLICATION_ACTIVE_PROFILES to the active profiles to be taken. e.g.
    APPLICATION_ACTIVE_PROFILES=prod,uswest2
    
    NOTE: Configurations will be loaded in the order of the given profiles. If same configuration is found in configuration files, later one will get the priority.
  • Create appsettings files for each profile with the desired configurations on the root of the application. e.g.
    appsettings.prod.json and
    appsettings.uswest2.json
    

Code

Use the new extension methond AddActiveProfileJsonConfiguration added to IConfigurationBuilder

config.AddActiveProfileJsonConfiguration()
  OR
config.AddActiveProfileJsonConfiguration(optional: true)
  OR
config.AddActiveProfileJsonConfiguration(optional: true, reloadOnChange:true)

Samples

Console and webapi sample projects can be found in sample folder. Don't forget to set environment variable APPLICATION_ACTIVE_PROFILES before running any sample.

activeprofileconfigurationextension's People

Stargazers

pkg⚡ avatar

Watchers

James Cloos avatar pkg⚡ avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.