From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 97BE71F453; Wed, 19 Sep 2018 07:39:26 +0000 (UTC) Date: Wed, 19 Sep 2018 07:39:26 +0000 From: Eric Wong To: Jeremy Evans Cc: unicorn-public@bogomips.org Subject: Re: Support default_middleware configurator method Message-ID: <20180919073926.fnwvgrkmszxxg5mw@dcvr> References: <20180913192055.GD48926@jeremyevans.local> <20180913223407.GA44494@ailurophile> <20180914000026.GG48926@jeremyevans.local> <20180914105626.cb4gl5mwdicnytmq@dcvr> <20180914150358.GH48926@jeremyevans.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180914150358.GH48926@jeremyevans.local> List-Id: Jeremy Evans wrote: > OK. To implement that, I modified the bin/unicorn file so -N > is only respected while parsing ARGV, and not while parsing > embedded configuration file options. Thanks. Unfortunately, -N on the command-line was broken by your patch. I fixed configurator.rb ordering (below) to pass t0300 integration test. Also, using a non-config.ru .rb file (TestHandler in test/unit/test_server.rb) was broken because of missing parentheses. Will squash the following changes in before pushing: diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb index 9c36dfe..d426edf 100644 --- a/lib/unicorn/configurator.rb +++ b/lib/unicorn/configurator.rb @@ -88,6 +88,9 @@ def reload(merge_defaults = true) #:nodoc: RACKUP[:set_listener] and set[:listeners] << "#{RACKUP[:host]}:#{RACKUP[:port]}" + RACKUP[:no_default_middleware] and + set[:default_middleware] = false + # unicorn_rails creates dirs here after working_directory is bound after_reload.call if after_reload @@ -714,9 +717,6 @@ def parse_rackup_file # :nodoc: /^#\\(.*)/ =~ File.read(ru) or return RACKUP[:optparse].parse!($1.split(/\s+/)) - if RACKUP[:no_default_middleware] - set[:default_middleware] = false - end if RACKUP[:daemonize] # unicorn_rails wants a default pid path, (not plain 'unicorn') diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 7531886..62f6171 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -786,7 +786,7 @@ def listener_names(listeners = LISTENERS) end def build_app! - if app.respond_to?(:arity) && app.arity == 0 || app.arity == 2 + if app.respond_to?(:arity) && (app.arity == 0 || app.arity == 2) if defined?(Gem) && Gem.respond_to?(:refresh) logger.info "Refreshing Gem list" Gem.refresh But there's still no tests for the config file option... I assume you tested that part locally? Thanks again.