mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 21:30:25 +08:00
What is the problem? We have a need to disable pitchfork via the `RUN_PITCHFORK` env. However, `RUN_PITCHFORK` is checked for existence/non-emptiness in both `bin/rails` and `config/unicorn_launcher`. This means setting `RUN_PITCHFORK=0` enables pitchfork, which is counterintuitive. What is the solution? Change the checks to explicitly test for the value `"1"`. Now only `RUN_PITCHFORK=1` enables pitchfork, while `0` or unset uses unicorn.
18 lines
522 B
Ruby
Executable file
18 lines
522 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
if !ENV["RAILS_ENV"] && (ARGV[0] == "s" || ARGV[0] == "server") && Process.respond_to?(:fork)
|
|
ENV["UNICORN_PORT"] ||= "3000"
|
|
|
|
if ARGV[1] == "-p" && (port = ARGV[2].to_i) > 0
|
|
ENV["UNICORN_PORT"] = port.to_s
|
|
end
|
|
|
|
ENV["RAILS_LOGS_STDOUT"] ||= "1"
|
|
|
|
exec File.expand_path(ENV["RUN_PITCHFORK"] == "1" ? "pitchfork" : "unicorn", __dir__)
|
|
end
|
|
|
|
APP_PATH = File.expand_path("../config/application", __dir__)
|
|
require_relative "../config/boot"
|
|
require "rails/commands"
|