module Bundler::Security::Config::FileFinder

Class used to figure out the file from which we should load the settings

Constants

FILE_NAMES

Names of the files or paths where we will look for the settings

@note We do the double dot trick, to look outside of the current dir because when

executed from a docker container, we copy the local uncommitted settings into the
dir above the app location not to pollute the reset state of the git repo

@note Order is important, as for local env we should load from

local file (if present first)

Public Class Methods

call(build_path) click to toggle source

Looks for coditsu settings file for a given env

@param build_path [String] path of the current build

@return [String] path to the file from which we should load all the settings

# File lib/bundler/security/config/file_finder.rb, line 31
def call(build_path)
  FILE_NAMES
    .map { |name| File.join(build_path, name) }
    .map { |name| Dir[name] }
    .find { |selection| !selection.empty? }
    .tap { |path| path || raise(Errors::MissingConfigurationFile) }
    .first
end