Coder Social home page Coder Social logo

gopupanavila / multiconf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lhupfeldt/multiconf

0.0 1.0 0.0 908 KB

Python module for data holder objects with multiple environment specific values for a single property

License: BSD 3-Clause "New" or "Revised" License

multiconf's Introduction

What

Multiconf is a framework for describing complex configuration for multiple environments using Python.

Why?

It started from a simple need of deployment automation for Java EE projects, Apache and more. Having worked on different projects with plain text property files or XML configuration files, I thought something better was needed. With plain text property files, the number of property files increases as projects and environments are added, and number of scripts increases too. It gets hard to get an overview of properties describing similar configurations. Has a property value been defined for all projects for every environment? And it is getting even harder to describe proper settings: what depends on what and what can be used and what can't. With XML you keep having to extend the schema and the tool processing it. So why use XML or property files when you can have your configuration directly in python? So, out of this Multiconf was born.

What are proper settings?

  • All configured ports follow one convention
  • All servers names follow one convention
  • Some configuration objects must have mandatory parameters (for example: Database name or URL required for Datasource object)
  • Some configuration objects must have mandatory children (for example: WebLogic Cluster doesn't make sense w/o Managed Servers)
  • Default settings are propagated through all environments and can be overridden for specific environments
  • No duplicated settings

How

Imagine that you have a project, where you are going to use Jboss and WebLogic. You are going to use database connections. And a project will typically have at least four environments: DevLocal (for developer's local machine), Dev (integration), Test and Prod, sometimes many more. The project configuration will be similar on different environments, but something will be different (databases, host names, number of hosts, number of WebLogic/Jboss servers, and ports, for example).

What Multiconf is

Multiconf provides a set of classes, where attributes may have different values for different environments, while enforcing that a value is defined for all defined environments. Multiconf allows you to implement your own DOM like object model and get early warning that something within your definition is wrong. Other tools use YAML or JSON to define settings of the components, but then you need something to validate those settings. Multiconf is both - definition and validation. Multiconf allows you to define environment groups, so that you can easily create new environments by adding them to a group and only override the values that differ from the group values.

What Multiconf is not

  • Multiconf itself doesn't know how to create environments.
  • Multiconf is not tied to configuration of any particular product or technology.
  • Multiconf doesn't know how to create any of the environment's components
  • Multiconf has nothing to execute

Running the demo:

Execute ./demo/demo.py --env (or 'python demo/demo.py ...'), e.g:

./demo/demo.py --env prod

If run without args it will print a usage message The valide environments are those specified at the top of demo/config.py

Running the test suite:

Execute: ./test/test.py This executes the test suite and the demo

Requirements

Multiconf: Python 2.7.3 Test Suite: pytest, pytest-cov, logilab-devtools, demjson (optional)

  • pip install -U pytest pytest-cov logilab-devtools demjson

multiconf's People

Contributors

lhupfeldt avatar lechat avatar henriklynggaard avatar

Watchers

Gopakumar Gopinathan 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.