module FigaroSecrets::Tasks

Public Class Methods

environment() click to toggle source
# File lib/figaro_secrets/tasks.rb, line 32
def self.environment
  ENV["RAILS_ENV"] || ENV["APP_ENV"] || "development"
end
list(environment: self.environment) click to toggle source
# File lib/figaro_secrets/tasks.rb, line 3
def self.list(environment: self.environment)
  title "Retrieving #{environment} configuration"
  config = Figaro.adapter.new(environment: environment).configuration
  output = []
  config.keys.sort.each do |key|
    output << "#{key}=#{config[key].inspect}"
  end
  puts output
  puts "\n"
end
secrets(environment: self.environment) click to toggle source
# File lib/figaro_secrets/tasks.rb, line 14
def self.secrets(environment: self.environment)
  title "Retrieving secrets from #{environment} configuration"
  figaro = Figaro.adapter.new(environment: environment)
  unparsed_secrets = figaro.unparsed_secrets
  secrets = figaro.secrets

  unparsed_secrets.each do |key, value|
    parsed_value = secrets[key]
    puts key
    puts "  #{value} => #{parsed_value.inspect}"
  end
  puts "\n"
end
title(title) click to toggle source
# File lib/figaro_secrets/tasks.rb, line 28
def self.title(title)
  puts "\n#{title}\n\n"
end