A simple way to authenticate in APIs
Add this line to your application's Gemfile:
gem 'lemur', github: 'petlove/lemur'
and run:
rails lemur:install
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
You can run the Lemur check in a bash script:
bash bin/lemur
Append this code in your pipeline.yml:
check_envs:
stage: build
title: Checking required environments
image: '${{build_docker_image}}'
commands:
- /app/bin/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.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Rails::Healthcheck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.