All Projects → freeletics → Creds

freeletics / Creds

Licence: mit
Encrypted & plain text credentials for multiple environments

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Creds

Draftsman
Ruby gem that lets you create draft versions of your database records.
Stars: ✭ 159 (+318.42%)
Mutual labels:  rails, ruby-gem
Tomo
A friendly CLI for deploying Rails apps ✨
Stars: ✭ 260 (+584.21%)
Mutual labels:  rails, ruby-gem
System tester
A Development Tool for creating and managing system tests for Ruby on Rails >= 5.1 Applications
Stars: ✭ 73 (+92.11%)
Mutual labels:  rails, ruby-gem
Pluck to hash
Extend ActiveRecord pluck to return array of hashes
Stars: ✭ 275 (+623.68%)
Mutual labels:  rails, ruby-gem
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+1134.21%)
Mutual labels:  rails, ruby-gem
Mobility
Pluggable Ruby translation framework
Stars: ✭ 644 (+1594.74%)
Mutual labels:  rails, ruby-gem
Email inquire
Validate email for common typos and one-time email providers
Stars: ✭ 257 (+576.32%)
Mutual labels:  rails, ruby-gem
Loaf
Manages and displays breadcrumb trails in Rails app - lean & mean.
Stars: ✭ 360 (+847.37%)
Mutual labels:  rails, ruby-gem
Devise masquerade
Extension for devise, enable login as functionality. Add link to the masquerade_path(resource) and use it.
Stars: ✭ 380 (+900%)
Mutual labels:  rails, ruby-gem
Motion
Reactive frontend UI components for Rails in pure Ruby
Stars: ✭ 498 (+1210.53%)
Mutual labels:  rails, ruby-gem
Devise Jwt
JWT token authentication with devise and rails
Stars: ✭ 881 (+2218.42%)
Mutual labels:  rails, ruby-gem
Activeadmin blaze theme
ActiveAdmin theme based on Blaze CSS toolkit
Stars: ✭ 35 (-7.89%)
Mutual labels:  rails
Jekyll Pug
Jekyll Plugin That Allows You To Use Pug
Stars: ✭ 30 (-21.05%)
Mutual labels:  ruby-gem
Activeadmin froala editor
Froala WYSIWYG editor for ActiveAdmin
Stars: ✭ 30 (-21.05%)
Mutual labels:  rails
Octopoller.rb
A micro gem for polling and retrying. Perfect for making repeating requests.
Stars: ✭ 30 (-21.05%)
Mutual labels:  ruby-gem
Redmine bootstrap kit
A Redmine plugin which makes developing your own Redmine plugin easy ;)
Stars: ✭ 36 (-5.26%)
Mutual labels:  rails
Ununiga
[은는이가] 한글 조사(助詞) 대응 I18n engine extension
Stars: ✭ 34 (-10.53%)
Mutual labels:  rails
Zache
Zero-footprint Ruby In-Memory Thread-Safe Cache
Stars: ✭ 30 (-21.05%)
Mutual labels:  ruby-gem
Versionist
A plugin for versioning Rails based RESTful APIs.
Stars: ✭ 950 (+2400%)
Mutual labels:  rails
Administrate Field Belongs to search
Plugin that adds search capabilities to belongs_to associations for Administrate
Stars: ✭ 29 (-23.68%)
Mutual labels:  rails

Creds

Manage encrypted credentials (added in Rails 5.2.0) with multiple environments.

Installation

Available as a gem creds

Usage

Using Rails command, generate new encrypted file by

bin/rails encrypted:edit config/credentials/production.yml.enc --key config/credentials/production.key

add some content in opened editor (note there is no environment root key, ie no production):

aws_access_key_id: my-access-key-id

If config/credentials/production.key doesn't exist yet, run bin/rails generate master_key and adjust naming to match desired one. Content of file can be displayed by

bin/rails encrypted:show config/credentials/production.yml.enc --key config/credentials/production.key

Add to config/environments/production.rb (or any other env)

config.creds = Creds.new("config/credentials/production.yml.enc")

If wants to use key from custom path - by default it checks RAILS_MASTER_KEY env key and config/master.key file:

config.creds = Creds.new("config/credentials/production.yml.enc", key_path: "config/credentials/production.key")

In the code:

Rails.configuration.creds.aws_access_key_id

To ease working in development/test environments with the same API, add config/credentials/plain.yml with key/value pairs nested under environment name, like:

development:
  aws_access_key_id: "aws-key-id"

Then add to config/environments/development.rb

config.creds = Creds.new("config/credentials/plain.yml", env: "development")

Rails 6.0

In Rails 6.0 it is possible to edit files by rails credentials:edit --environment production which will look for config/credentials/production.yml.enc encrypted by ENV["RAILS_MASTER_KEY"] or config/credentials/production.key

Additions

  • To raise error in case of missing key you can add bang to the name, like Rails.configuration.creds.database_url!
  • To list all defined key/value pairs call config, like Rails.configuration.creds.config
  • Plain text file can embed Ruby (<%= %>), but not encrypted one
  • If secret_key_base is specified in credentials file, it will be assigned to Rails.configuration.secret_key_base, as it is required by Rails

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/freeletics/creds

License

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

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].