mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 23:43:45 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
50 lines
1.2 KiB
Ruby
Executable File
50 lines
1.2 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
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
|
|
|
|
# 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
|
|
|
|
ENV["UNICORN_PORT"] ||= "9292"
|
|
|
|
if ARGV.delete("-x")
|
|
puts "Running without sidekiq"
|
|
ENV["UNICORN_SIDEKIQS"] = "0"
|
|
end
|
|
|
|
ENV["UNICORN_SIDEKIQS"] ||= "1"
|
|
|
|
end
|
|
|
|
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
|
|
|
|
load Gem.bin_path('unicorn', 'unicorn')
|