• Stars
    star
    76
  • Rank 420,374 (Top 9 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The simplest yaml to ENV config loader.

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

More Repositories

1

bitly

🗜 A Ruby wrapper for the bit.ly API
Ruby
447
star
2

pwned

😱 An easy, Ruby way to use the Pwned Passwords API.
Ruby
360
star
3

react-express-starter

A starter kit for React applications with a back end server all in the same project
JavaScript
179
star
4

react-web-audio

A small example React app that listens to the microphone and visualises the audio
JavaScript
163
star
5

mediadevices-camera-selection

🎥 Examples on how to switch devices with the mediaDevices API
JavaScript
162
star
6

twilio-video-react-hooks

A video chat application built with Twilio Video and React Hooks
JavaScript
105
star
7

screen-capture

An exploration of screen capture in browsers.
JavaScript
103
star
8

ngrok-for-vscode

🚇 A VSCode extension to control ngrok from the command palette
TypeScript
103
star
9

meta-spotify

[deprecated] A ruby wrapper for the Spotify Metadata API
Ruby
84
star
10

sms-messages-app

A web powered SMS Messages app you can use with a Twilio number
CSS
69
star
11

web-assistant

A collection of experiments building towards a browser powered assistant
HTML
65
star
12

crotp

CrOTP - One Time Passwords for Crystal
Crystal
62
star
13

useful-twilio-functions

A set of useful Twilio Functions.
JavaScript
53
star
14

video-chat

An example of setting up basic video chat with WebRTC, node.js and Twilio
JavaScript
37
star
15

jekyll-gzip

Generate gzipped assets and files for your Jekyll site at build time
Ruby
35
star
16

react-twilio-phone

A Twilio Client based web phone, built with React
JavaScript
34
star
17

philna.sh

Phil Nash's personal site and blog
Astro
33
star
18

bulk-sms-alerts

An example of sending one, a few and many SMS messages using the Twilio APi
JavaScript
33
star
19

send-sms-react-twilio

An example React application that can send SMS messages via the Twilio API
JavaScript
32
star
20

react-programmable-chat

A React example of Twilio Programmable Chat
JavaScript
29
star
21

web-share-wrapper

A web component that wraps other share elements to replace with a web share button where supported.
JavaScript
22
star
22

twilio-video-svelte

A Twilio Video application built with Svelte
Svelte
21
star
23

whats_playing

Collaborative playlists over WhatsApp with Twilio and Spotify
Ruby
21
star
24

first-twilio-video-application

A demo of Twilio Video for the Build your first Twilio Video application webinar.
JavaScript
20
star
25

ruby-whatsapp-bots

A repo of WhatsApp bots built in Ruby
Ruby
19
star
26

ruby-google-sheets-sinatra

An example app using Ruby, Google Sheets and Sinatra
HTML
18
star
27

twiml_template

TwiML templates for Rails and Tilt.
Ruby
17
star
28

quote-bot

A bot built with Twilio SMS and Claudia Bot Builder
JavaScript
15
star
29

jekyll-brotli

Generate brotli compressed assets and files for your Jekyll site at build time
Ruby
15
star
30

twilio-chat-kendo-react

An example Twilio Programmable Chat application application using React and KendoReact Conversational UI
JavaScript
14
star
31

service-worker-background-fetch

A proof of concept of the background fetch API
HTML
12
star
32

guybot

A mighty pirate (and Twitter bot)
Ruby
12
star
33

jekyll-zopfli

Generate gzipped assets and files for your Jekyll site at build time using Zopfli compression
Ruby
12
star
34

ruby-quick-test

Run ruby test files quickly in Atom
CoffeeScript
12
star
35

jekyll-web_monetization

A Jekyll plugin to add Web Monetization API payment pointers to your site
Ruby
10
star
36

whatsapp-bot-capabilities

An example of a WhatsApp bot that can respond to location messages and can send images, vcards and location messages
JavaScript
9
star
37

pwned.js

An easy, promise based, way to test passwords securely against the Pwned Passwords API v2 in Node.js.
TypeScript
9
star
38

leap-motion-experiments

JavaScript
9
star
39

the-web-is-getting-pushy

An example of push notifications and service workers
JavaScript
9
star
40

web-monetization-components

A collection of web components you can use on your web monetized websites.
HTML
8
star
41

twilio-video-screen-sharing

JavaScript
8
star
42

community-sms-broadcast

An application that you can use to broadcast SMS messages to people listed on a Google Spreadsheet, powered by Twilio Functions and Twilio Programmable SMS
JavaScript
8
star
43

jsconf-schedule

An offline HTML schedule for JSConf EU
CSS
8
star
44

time-formatter

A web component that converts a date time into your user's time zone and formats it locally.
HTML
7
star
45

twilio-fax-ruby-sinatra

An application to send faxes with the Twilio Fax API
Ruby
7
star
46

jekyll-mastodon_webfinger

A Jekyll plugin that adds a WebFinger file to your site, allowing you to use your own domain to help others discover your Mastodon profile.
Ruby
7
star
47

twitter-sms

Send and receive tweets by SMS
Ruby
7
star
48

web-otp-input

A custom element to make it really easy to use the WebOTP API
JavaScript
6
star
49

super-secret-puppies

Ruby
6
star
50

tatooine

A Ruby interface to SWAPI (the Star Wars API).
Ruby
6
star
51

rails-phone-number-verification

An example application for verifying phone numbers in a Rails application.
Ruby
6
star
52

phism

A video collaboration app that we're building on Twitch: https://twitch.tv/phil_nash
JavaScript
5
star
53

whatrtc

WhatRTC? Everything you need to know to connect browsers to the world.
CSS
5
star
54

github-weekends

A silly browser extension that marks weekend contributions on GitHub's contribution graph in red
JavaScript
5
star
55

ship-it

Don't just comment, ship it.
JavaScript
5
star
56

envyable.cr

The simplest YAML to ENV config loader in Crystal
Crystal
5
star
57

fxrates-ios

A currency exchange rate calculator for iOS, written in Swift
Swift
4
star
58

sendgrid-email-status

A Rails application that sends emails via the SendGrid API and tracks their status
Ruby
4
star
59

getUserMedia

An example of using getUserMedia
JavaScript
4
star
60

twilio-video-chat-web-component

A Web Component version of Twilio Video [deprecated]
HTML
4
star
61

advent-of-code

Advent of Code 2017-2020 solutions in Crystal
Crystal
4
star
62

omg

Quick and dirty debugging any ruby!
Ruby
4
star
63

sms-bulb

HTML
4
star
64

collabify

CSS
4
star
65

celebrity-spotting

A Sinatra app that takes images from the Twilio API for WhatsApp and uses AWS Rekognition to spot celebrities
Ruby
4
star
66

ynfb

YNFB
Ruby
3
star
67

elixir-examples

Elixir
3
star
68

twiml_template_example

Examples on using the twiml_template gem
Ruby
3
star
69

contact-picker-twilio-client

A browser based phone that uses the Contact Picker API
JavaScript
3
star
70

fun-with-getusermedia

Fun with getUserMedia
JavaScript
2
star
71

exploring-amp-email

A collection of projects implementing AMP email with SendGrid
JavaScript
2
star
72

hubot-twilio-ip-messaging

A Hubot adapter for Twilio IP Messaging
CoffeeScript
2
star
73

thereminjs

JavaScript
2
star
74

four-steps-from-javascript-to-typescript

JavaScript
2
star
75

philnash

philnash/philnash is philnash's repo about philnash
JavaScript
2
star
76

jira-twilio-plugins

HTML
2
star
77

twilio-client-and-accessibility

Exploring accessiblity and Twilio Client
Ruby
2
star
78

superclass-twilio-video-demo

A demo of Twilio Video for Superclass 2019
JavaScript
2
star
79

ng-sms-messages

An SMS application for Twilio, written with Angular and Service Workers
TypeScript
2
star
80

video-collaboration

An application using Twilio Video implementing various collaboration features
JavaScript
2
star
81

advanced-twilio-video

An example of using some advanced Twilio Video features to improve the user experience
JavaScript
2
star
82

twilio-liftoff

The example code for the Twilio Liftoff webinar series
JavaScript
2
star
83

sms-messages-hanami

An example application for receiving and responding to SMS messages from Twilio in Hanami
Ruby
2
star
84

pirate-api

🏴‍☠️ An API wrapper for translating from English to Pirate and generating pirate insults ☠️
TypeScript
2
star
85

worlds-worst-synth

The world's worst synth
JavaScript
2
star
86

dad-jokes-cli

A CLI for getting Dad Jokes
JavaScript
1
star
87

crystal-experiments

Crystal Experiments with the Twilio API
Crystal
1
star
88

install-service-worker

Three different ways to install a service worker
HTML
1
star
89

twilio-typescript-examples

Examples of using Twilio with TypeScript
TypeScript
1
star
90

WindowSize

A bookmarklet to get the current height and width of the viewport
JavaScript
1
star
91

Sheenboard

1
star
92

bluemix-twilio-alchemy

HTML
1
star
93

discogs-scanner

A web app to scan records and add them to your Discogs collection
Svelte
1
star
94

twilio-autopilot-competition-entry-bot

The back-end Twilio Functions for a Twilio Autopilot bot that asks questions and enters people into a competition
JavaScript
1
star
95

todomvc-indexeddb

A vanilla JS implementation of TodoMVC with an IndexedDB data store
JavaScript
1
star
96

rainbow

A silly demo of device orientation events
1
star
97

taskrouter_priority

A priority call centre built with Twilio TaskRouter
Ruby
1
star
98

asst

A command line interface for OpenAI's ChatGPT written in JavaScript
JavaScript
1
star
99

growler_alerts_starter

HTML
1
star
100

simulring-control

A Twilio Function that pulls and filters numbers from a Google Sheet to be used in a Studio Flow
JavaScript
1
star