From: Eric Wong <e@80x24.org>
To: Jeremy Evans <code@jeremyevans.net>
Cc: unicorn-public@bogomips.org
Subject: Re: Support default_middleware configurator method
Date: Wed, 19 Sep 2018 07:39:26 +0000 [thread overview]
Message-ID: <20180919073926.fnwvgrkmszxxg5mw@dcvr> (raw)
In-Reply-To: <20180914150358.GH48926@jeremyevans.local>
Jeremy Evans <code@jeremyevans.net> 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.
next prev parent reply other threads:[~2018-09-19 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 19:20 Support default_middleware configurator method Jeremy Evans
2018-09-13 22:34 ` Eric Wong
2018-09-14 0:00 ` Jeremy Evans
2018-09-14 10:56 ` Eric Wong
2018-09-14 15:03 ` Jeremy Evans
2018-09-19 7:39 ` Eric Wong [this message]
2018-09-21 0:21 ` Jeremy Evans
2018-09-23 8:52 ` Eric Wong
2018-09-21 0:34 ` [PATCH 2/1] tests: ensure -N/--no-default-middleware not supported in config.ru Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180919073926.fnwvgrkmszxxg5mw@dcvr \
--to=e@80x24.org \
--cc=code@jeremyevans.net \
--cc=unicorn-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).