Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
/ chemtrails Public archive

Chemtrails is a gem used to integrate a Rails app with a Spring Cloud Config server.

License

Notifications You must be signed in to change notification settings

vmware-archive/chemtrails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chemtrails

Build Status Code Climate Test Coverage

This gem allows you to fetch the configuration for your rails app from a Spring Cloud Config server.

Installation

Add this line to your application's Gemfile:

gem 'chemtrails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chemtrails

Configuration

To use your own config server, set the location and of your config server and any necessary credentials in the environment:

CONFIG_SERVER_URL=http://localhost:8080
CONFIG_SERVER_USERNAME=username
CONFIG_SERVER_PASSWORD=password

To use a Config Server service on PWS, set:

USE_P_CONFIG_SERVER_SERVICE=true

The rest of the configuration is the same regardless of what type of server you are using.

If you want to request values that are not on the master branch, you can optionally supply the branch name:

CONFIG_SERVER_BRANCH=production

If this is not provided, Spring Cloud Config will return values from the master branch.

You will also need to set your Rails environment so that Chemtrails knows which profile to fetch properties for.

RAILS_ENV={env}

If you'd like to fetch properties from a different profile (or multiple profiles) use CONFIG_SERVER_PROFILE_ACTIVE to override. e.g.

CONFIG_SERVER_PROFILE_ACTIVE=staging,web,noclip,muted

When your Rails app boots, it will fetch the configuration for the given environment from the config server and populate the ENV with the values it finds. It will use the application name and environment name to determine which set of values to fetch. For example, if the application is named Sandwich and is running in the production environment, it will fetch the configuration from the endpoint $CONFIG_SERVER_URL/sandwich/production. With Spring Cloud Config, this corresponds to a property source named sandwich-production.properties.

Disabling

If you do not provide a CONFIG_SERVER_URL then Chemtrails will not try to fetch variables from a config server.

Releasing a new version

Increase the version number in lib/chemtrails/version.rb

gem build chemtrails.gemspec
gem push chemtrails-$VERSION.gem

Credentials are in lastpass

License

The gem is available as open source under the terms of the MIT License.