Giter Club home page Giter Club logo

configtailor's Introduction

ConfigTailor

ConfigTailor is a hierarchical configuration compiler that produces a config file for all of your environments.

ConfigTailor makes it easy to manage your application configuration across any dimension including regions, regions, and cloud accounts. ConfigTailor is used to produce JSON configuration files that are consumed by your application in different environments.

Extensions

ConfigTailor allows you to substitute and extend JSON values from parent directories config.json. For example, at the top level you can add a config.json file with a global default value that you can override in subdirectories.

config compiler breakdown

In the example above, we define in the top level root that "env": "root" and "name":"root". While prod, dev, and test are all subdirectories. We then override "env" in each subdirectory while only overriding "name" in prod. This results in both values overwritten in prod while only "name" is plumbed from root in "dev" and "test".

Example Config

Follow a directory pattern like:

config
├── config.json
├── dev
│   └── config.json
└── prod
    └── region
        └── config.json

file: config/config.json

{
    "global_value": "set_everywhere",
}

Variable Substitution

Example using the variable region.

file: config/prod/region/config.json

{
    "base_uri": "$region.telophase.dev"
}

Then you can run configtailor with a region mapping region:us-west-2,us-east-1,eu-west-1:

configtailor compile --rootpath=config --mappings=region:us-west-2,us-east-1,eu-west-1

config compiler breakdown

Example output for config_generated/prod/us-west-2/config.json:

{
    "global_value": "set_everywhere",
    "base_uri": "us-west-2.telophase.dev"
}

While also outputting the following files:

  • config_generated/prod/us-west-2/config.json
  • config_generated/prod/us-east-1/config.json
  • config_generated/prod/eu-west-1/config.json
  • config_generated/dev/config.json

View more detailed outputs by looking in the example directory and the corresponding generated files in example_generated.

Installing

Install the configtailor CLI via go.

go install github.com/santiago-labs/configtailor@latest

Why?

In recent years, cell architecture has become more popular.

Application configuration becomes more complex with cell architecture. Copy and pasting config files is prone to errors, so we built ConfigTailor to edit all of our cell's configs in a single location.

For our configuration, we want:

  • version control
  • a single source of truth for each region's config

ConfigTailor enables this through a simple CLI that compiles configuration files from a source directory structure.

Obligatory Plug

If you like this project, at Telophase we are building tools to make it easier to make your application multi-region or stand up cells. We'd love to chat if you are building out cell infrastructure. Reach out to us at [email protected]

configtailor's People

Contributors

dschofie avatar

Stargazers

 avatar Oleg Pykhalov avatar Clayton Kehoe avatar Tim Kersey avatar wolfi3 avatar Rock Sun avatar  avatar  avatar Can Evgin avatar Wolverine avatar Ethan Blackburn avatar Mark Lyons avatar Dylan Kapoor avatar Omar Abdelkader avatar  avatar  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.