Git Product home page Git Product logo

firestore.configurationprovider's Introduction

Firestore.ConfigurationProvider

.Net Core Configuration Provider that allows developers to use Google Cloud Firestore as a Configuration Source in their applications.

Build status

FirestoreConfigurationOptions

Setting Default Value Description
FIRESTORECONFIG_ENABLED true Enable or disable configuration load
FIRESTORECONFIG_PROJECTID "" The google cloud project identifier where the firestore service exists
FIRESTORECONFIG_APPLICATION AppDomain.CurrentDomain.FriendlyName Name of the application
FIRESTORECONFIG_STAGE ASPNETCORE_ENVIRONMENT Name of the current environment
FIRESTORECONFIG_TAG "Default" Useful for application versioning, blue-green deployment or any other stage subclassification

Add Firestore Configuration in Program class

  public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureAppConfiguration((hostContext, config) =>
            {
              config.AddFirestoreConfiguration();
            })            
            .ConfigureWebHostDefaults(webBuilder =>
            {
              webBuilder.UseStartup<Startup>();
            });
  }

Automatic Settings Upload

For the first time, automatically load the appsettings.json file into a Firestore Document named as the application and also a Stages collection will be created with an empty Document named as the current environment.

Change Detection

The provider will be listening for changes in these documents:

  1. ApplicationSettings/{applicationName}
  2. ApplicationSettings/{applicationName}/Stages/{stageName}
  3. ApplicationSettings/{applicationName}/Stages/{stageName}/Machines/{machineName}
  4. ApplicationSettings/{applicationName}/Stages/{stageName}/Tags/{tag}

When a change is made in any document, the provider reload the configuration in order from general to particular (Application -> Stage -> Machine -> Tag).

Machines and Tags collections are at stage level so when you configure both the tag configuration overrides the machine configuration.

Usage

Since the settings are loaded from Firestore into the Application Configuration they will be available through the IConfiguration interface at Startup, just like the settings declared in environment variables or appsettings.json file.

firestore.configurationprovider's People

Contributors

hectorescalante avatar

Watchers

 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.