2018-08-07 02:13:20 -05:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'pathname'
|
|
|
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
|
|
Pathname.new(__FILE__).realpath)
|
|
|
|
|
|
|
|
require 'rubygems'
|
|
|
|
require 'bundler/setup'
|
|
|
|
|
|
|
|
# in development do some fussing around, to automate config
|
|
|
|
if !ARGV.include?("-E") &&
|
|
|
|
!ARGV.include?("--env") &&
|
|
|
|
(ENV["RAILS_ENV"] == "development" || !ENV["RAILS_ENV"])
|
|
|
|
|
|
|
|
ARGV.push("-N")
|
|
|
|
if !ARGV.include?("-c") && !ARGV.include?("--config-file")
|
|
|
|
ARGV.push("-c")
|
|
|
|
ARGV.push(File.expand_path("../../config/unicorn.conf.rb",
|
|
|
|
Pathname.new(__FILE__).realpath))
|
|
|
|
end
|
|
|
|
|
2018-08-14 19:35:24 -05:00
|
|
|
# we do not want to listen on 2 ports, so lets fix it
|
|
|
|
if (idx = ARGV.index("-p")) && (port = ARGV[idx + 1].to_i) > 0
|
|
|
|
ENV["UNICORN_PORT"] ||= port.to_s
|
|
|
|
end
|
|
|
|
|
2018-08-07 03:20:08 -05:00
|
|
|
ENV["UNICORN_PORT"] ||= "9292"
|
2018-08-16 19:01:44 -05:00
|
|
|
|
|
|
|
if ARGV.delete("-x")
|
|
|
|
puts "Running without sidekiq"
|
|
|
|
ENV["UNICORN_SIDEKIQS"] = "0"
|
|
|
|
end
|
|
|
|
|
2018-08-07 03:20:08 -05:00
|
|
|
ENV["UNICORN_SIDEKIQS"] ||= "1"
|
2018-08-07 03:27:44 -05:00
|
|
|
|
2018-08-07 02:13:20 -05:00
|
|
|
end
|
|
|
|
|
2018-08-16 19:01:44 -05:00
|
|
|
if ARGV.include?("--help")
|
|
|
|
fork do
|
|
|
|
load Gem.bin_path('unicorn', 'unicorn')
|
|
|
|
end
|
|
|
|
Process.wait
|
|
|
|
puts "Extra Discourse Options:"
|
|
|
|
puts " -x run without sidekiq"
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
|
2018-08-07 02:13:20 -05:00
|
|
|
load Gem.bin_path('unicorn', 'unicorn')
|