All Projects → philnash → envyable

philnash / envyable

Licence: MIT license
The simplest yaml to ENV config loader.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to envyable

envman
Manage your .env configuration easily
Stars: ✭ 20 (-74.36%)
Mutual labels:  environment-variables, env, environment-vars
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (-7.69%)
Mutual labels:  environment-variables, configuration-management, env
Node Convict
Featureful configuration management library for Node.js
Stars: ✭ 1,855 (+2278.21%)
Mutual labels:  environment-variables, configuration-management, env
env-dot-prop
♻️ Get, set, or delete nested properties of process.env using a dot path
Stars: ✭ 31 (-60.26%)
Mutual labels:  environment-variables, env, environment-vars
envkey-ruby
EnvKey's official Ruby client library
Stars: ✭ 24 (-69.23%)
Mutual labels:  environment-variables, configuration-management
envfile
Parse and write environment files with Node.js
Stars: ✭ 42 (-46.15%)
Mutual labels:  environment-variables, env
envkeygo
EnvKey's official Go client library
Stars: ✭ 36 (-53.85%)
Mutual labels:  environment-variables, configuration-management
Dynaconf
Configuration Management for Python ⚙
Stars: ✭ 2,082 (+2569.23%)
Mutual labels:  environment-variables, configuration-management
env
A lightweight package for loading OS environment variables into structs for Go projects
Stars: ✭ 24 (-69.23%)
Mutual labels:  environment-variables, env
Fsconfig
FsConfig is a F# library for reading configuration data from environment variables and AppSettings with type safety.
Stars: ✭ 108 (+38.46%)
Mutual labels:  environment-variables, configuration-management
webpack-dotenv-plugin
Use dotenv with webpack.
Stars: ✭ 53 (-32.05%)
Mutual labels:  environment-variables, env
angular-environment
AngularJS Environment Plugin
Stars: ✭ 78 (+0%)
Mutual labels:  environment-variables, environment-vars
envmnt
Environment variables utility functions.
Stars: ✭ 16 (-79.49%)
Mutual labels:  environment-variables, environment-vars
envclasses
envclasses is a library to map fields on dataclass object to environment variables.
Stars: ✭ 26 (-66.67%)
Mutual labels:  environment-variables, env
gatsby-plugin-dynamic-routes
Creating dynamic routes based on your environment and/or renaming existing routes
Stars: ✭ 14 (-82.05%)
Mutual labels:  environment-variables, env
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (-60.26%)
Mutual labels:  environment-variables, env
read-env
🔧 Transform environment variables into JSON object with sanitized values.
Stars: ✭ 60 (-23.08%)
Mutual labels:  environment-variables, env
tfenv
Transform environment variables for use with Terraform (e.g. `HOSTNAME` ⇨ `TF_VAR_hostname`)
Stars: ✭ 120 (+53.85%)
Mutual labels:  environment-variables, env
sicher
Sicher is a go module that allows secure storage of encrypted credentials in a version control system.
Stars: ✭ 27 (-65.38%)
Mutual labels:  environment-variables, env
aws-export-profile
Export AWS profiles to your shell environment
Stars: ✭ 45 (-42.31%)
Mutual labels:  environment-variables, environment-vars

Envyable

The simplest yaml to ENV config loader.

Gem version Build Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'envyable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install envyable

Install task

Once the gem is included in your project, you can then use it to generate the default required files. Just run:

$ envyable install

and you will get a config directory containing an env.yml and a env.yml.example file. If you have a .gitignore file this will also append the line:

/config/env.yml

to your config so that you do not check in /config/env.yml.

If you have Spring bundled with your application this will append the following line to /config/spring.rb:

Spring.watch 'config/env.yml'

If the file /config/spring.rb does not exist, it will be created.

Usage

YAML file

Create a yaml file that holds your settings. You can put default settings into the root of the yaml file and then override those on an environment by environment basis. For example, the following yaml file will load the id "development-id" into all environments it is loaded in except for the test environment, where the id would be "test-id".

API_CLIENT_ID: development-id
test:
  API_CLIENT_ID: test-id

Rails

Once installed in a Rails app, add your yaml file at config/env.yml. The gem will load the correct environment on initialization of the application. If you are using Spring to load your Rails application, add config/env.yml to Spring's watch list.

Load Immediately

If you have gems that require variables to be set earlier then place envyable in the Gemfile before those gems and require envyable/rails-now:

gem 'envyable', require: 'envyable/rails-now'
gem 'other-gem-that-requires-env-variables'

Other applications

With the exception of loading Envyable immediately via the Gemfile, you can create your yaml file anywhere (though why not config/env.yml?). To load your yaml file into ENV, call:

Envyable.load('path/to/yml', environment)

The default environment is development if you leave that argument blank. For example, if your variables are in a config folder in a file called env.yml, and you want to load development only, include in your script:

require 'envyable'
Envyable.load('config/env.yml')

Version control

It is not recommended that you check the yaml file in to version control. Personally, I like to check in a env.yml.example file that shows the required keys, but does not include any credentials. If you generate your Envyable files using the installer, config/env.yml will be added to your .gitignore file.

Troubleshooting

If your ENV values don't update when you modify config/env.yml, verify whether you have Spring (or another application preloader) that isn't configured to watch and reload when you update values. You should try configuring the preloader or just restarting it.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].