/lemur

Environment builder and checker

Primary LanguageRubyMIT LicenseMIT

Build Status Maintainability Test Coverage

A simple way to authenticate in APIs

Installation

Add this line to your application's Gemfile:

gem 'lemur', github: 'petlove/lemur'

and run:

rails lemur:install

Settings

Set the settings in the file config/initializers/lemur.rb:

# frozen_string_literal: true

require 'bundler/setup'
require 'lemur'

DEFAULT_KEYS = %w[RAILS_ENV].freeze

Lemur.configure do |config|
  config.add_keys(DEFAULT_KEYS, true)
  # config.add_keys(STAGING_KEYS, ENV['APP_ENV'] == 'staging')
  # config.add_keys(PRODUCTION_KEYS, ENV['APP_ENV'] == 'production')
end

Running the checker in a script

You can run the Lemur check in a bash script:

bash bin/lemur

Using the checker in Codefresh pipelines

Append this code in your pipeline.yml:

check_envs:
  stage: build
  title: Checking required environments
  image: '${{build_docker_image}}'
  commands:
    - /app/bin/lemur

Build Codefresh envs using Lemur

You can use Lemur to build your Codefresh Gems

First, create your .env.lemur files for each environment that you need with the header # file:.... This .env should be in your project root. For this example, the name is .env.lemur.prod:

# file:codefresh/deployments/prod.yml

APP_TYPE=web
APP_ENV={{APP_ENV}}

OBS: Don't put '' in your keys, like '{{APP_ENV}}'. OBS 2: You can set many files to update with a single .env.lemur file

After create this file, you should run the builder task:

rails lemur:build_envs

So, the file codefresh/deployments/prod.yml was updated with the .env.lemur.prod environments.

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

License

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

Code of Conduct

Everyone interacting in the Rails::Healthcheck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.