A simple helper that selects some configuration from credentials or environment variable
# frozen_string_literal: true module Credentials # Returns credentials or env # OBS: Does not support nested credentials # @example Credentials::credentials_or_env('LIBRARY_SERVICE_URL', default: 'http://localhost:30000') def self.credentials_or_env(string_key, default: nil) credentials_key = string_key.downcase.to_sym Rails.application.credentials.dig(credentials_key) || ENV.fetch(string_key, default) end end