Refactor: revisit logstash bootstraping bits (#13791)

* Refactor: logstash boot to know what to do
* Refactor: reduce LOAD_PATH - load jars directly
* Refactor: unused requires in runner
* Refactor: boot - require libs when to be used
This commit is contained in:
Karol Bucek 2022-02-17 13:59:38 +01:00 committed by GitHub
parent f1b17be5d1
commit 4f32c4fd48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 19 deletions

View file

@ -76,10 +76,7 @@ module LogStash
end
end
# when launched as a script, not require'd, (currently from bin/logstash and bin/logstash-plugin) the first
# argument is the path of a Ruby file to require and a LogStash::Runner class is expected to be
# defined and exposing the LogStash::Runner#main instance method which will be called with the current ARGV
# currently lib/logstash/runner.rb and lib/pluginmanager/main.rb are called using this.
# when launched as a script, not require'd, (currently from bin/logstash)
if $0 == __FILE__
bundler_options = {:without => [:build, :development]}
## Check for dev flags - this needs to be done before the runner is invoked to set bundler options
@ -89,7 +86,7 @@ if $0 == __FILE__
LogStash::Bundler.setup!(bundler_options)
require_relative "patches/jar_dependencies"
require ARGV.shift
require 'logstash/runner'
exit_status = LogStash::Runner.run("bin/logstash", ARGV)
exit(exit_status || 0)
end