From bde15cfd25de61a22055eae2ee54b077cd57b061 Mon Sep 17 00:00:00 2001 From: Glenn Date: Fri, 5 Jan 2024 11:47:52 +0100 Subject: [PATCH] feat: env CODE_PRELOADER_DETECT=no disables config auto-detect --- src/config.cr | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config.cr b/src/config.cr index 810d6be..2c98917 100644 --- a/src/config.cr +++ b/src/config.cr @@ -86,8 +86,10 @@ module CodePreloader def parse_pack_options(parser) @pack_options = PackOptions.new - config_file = detect_config_file - config_file.try { |path| load_pack_config(path) } + unless ENV["CODE_PRELOADER_DETECT"]? =~ /(no|false|0)/i + config_file = detect_config_file + config_file.try { |path| load_pack_config(path) } + end parser.banner = [ "Usage: code-preloader pack [options] DIR ...\n", @@ -99,7 +101,7 @@ module CodePreloader parser.on( "-c FILE", "--config=FILE", - "Load parameters from FILE\n(default: \".code_preload.yml\", if present)" + "Load parameters from FILE\n(default: autodetect)" ) do |config_file| @pack_options.try { |opt| load_pack_config(config_file) } end