Project

cre

0.0
Low commit activity in last 3 years
No release in over a year
Cre reduces the amount of code you have to write when fetching rails credentials. If your encrypted credentials look like this: production: password: 'foobar' development: password: 'foobar' test: password: 'foobar' Usually you have to get it like this: `Rails.application.credentials.dig(Rails.env, :password)` with Cre you can just do: `Cre.dig(:password)`. By default it grabs the current Rails environment. To overwrite this behavior add the enviroment as the first argument: `Cre.dig(:production, :password)`
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.11
>= 3.8
>= 0.10
~> 1.4, >= 1.4.2

Runtime

>= 5.2
 Project Readme

Build Status Gem Version

Cre

This gem basically lets you dig out the rails encrypted credentials by simply doing:

Cre.dig(:password)

Instead of going the long way:

Rails.application.credentials.dig(Rails.env.to_sym, :password)

Usage

By default it uses the currently active rails environment. Specify the environment specifically by adding it as the first argument. But do remember that it only considers defined environments in config/environments

Cre.dig(:production, :password)

⚠️ This assumes your credentials are setup like:

production:
  aws_key: 'somekeyproduction'
  password: 'fakepass'
development:
  aws_key: 'somekeydevelopment'
  password: 'fakepass'
test:
  aws_key: 'somekeytest'
  password: 'fakepass'

It also supports deeper nested credentials for example:

Cre.dig(:production, :aws, :client, secret, :key)

Or:

Cre.dig(:something, :nested, :multiple, :layers, :deep)

Installation

Add this line to your application's Gemfile:

gem 'cre', '~> 2.1.1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cre

##Todo:

  • Exeption handeling

Contributing

Contribution directions go here.

License

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