Giter Club home page Giter Club logo

amberbit-config's Introduction

AmberBit Config

Provides simple global configuration for Ruby on Rails application using YAML files.

Installation:

As a local gem:


1. Edit Gemfile, located in your application and add the following line:
    gem "amberbit-config", :path => "amberbit-config"
2. Run bundle:
    bundle
3. Use rake for running tasks:
    rake amberbit:config:setup

Usage:

Place your application configuration default values into #{Rails.root}/config/app_config_default.yml:

default:
  application:
    name: SuperApp
    url: http://localhost:3000/

test:
  # overwrite application.url key only in test env
  application:
    url: http://testhost:3000/

And overwrite values you wish on per-installation basis in #{Rails.root}/config/app_config.yml:

default:
  application:
    name: SuperApp specially for you

production:
  application:
    url: http://yoursuperhiperdomain.com

In your application Ruby code you can access the values in 2 following ways:

AppConfig["application"]["name"] #=> SuperApp specially for you

or

AppConfig.application.name #=> SuperApp specially for you

Keys are deep-merged, for example:

production env:

AppConfig.application.name #=> SuperApp specially for you
AppConfig.application.url #=> http://yoursuperhiperdomain.com

development env:

AppConfig.application.name #=> SuperApp specially for you
AppConfig.application.url #=> http://localhost:3000/

Copyright © 2008/2011 Wojciech Piekutowski, Hubert Łępicki, Piotr Tynecki released under the MIT license

amberbit-config's People

Contributors

hubertlepicki avatar ptynecki avatar wpiekutowski avatar

Stargazers

 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.