mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
Initialize the path.settings
inside the runner class
The `path.settings` requires the LOGSTASH_HOME constant to be defined, the problem is that constant is only defined when you are actually inside the logstash application, This was causing a bug when you were testing plugin individually because that constant wasn't defined. Fixes: #5361 Fixes #5363
This commit is contained in:
parent
5e5c0c0844
commit
f1f1a542e9
2 changed files with 8 additions and 1 deletions
|
@ -13,7 +13,6 @@ module LogStash
|
|||
Setting::Boolean.new("config.reload.automatic", false),
|
||||
Setting::Numeric.new("config.reload.interval", 3),
|
||||
Setting::Boolean.new("metric.collect", true) {|v| v == true }, # metric collection cannot be disabled
|
||||
Setting::String.new("path.settings", ::File.join(Environment::LOGSTASH_HOME, "config")),
|
||||
Setting::String.new("pipeline.id", "main"),
|
||||
Setting::Numeric.new("pipeline.workers", LogStash::Config::CpuCoreStrategy.maximum),
|
||||
Setting::Numeric.new("pipeline.output.workers", 1),
|
||||
|
|
|
@ -15,8 +15,14 @@ require "logstash/agent"
|
|||
require "logstash/config/defaults"
|
||||
require "logstash/shutdown_watcher"
|
||||
require "logstash/patches/clamp"
|
||||
require "logstash/settings"
|
||||
|
||||
class LogStash::Runner < Clamp::StrictCommand
|
||||
# The `path.settings` need to be defined in the runner instead of the `logstash-core/lib/logstash/environment.r`
|
||||
# because the `Environment::LOGSTASH_HOME` doesn't exist in the context of the `logstash-core` gem.
|
||||
#
|
||||
# See issues https://github.com/elastic/logstash/issues/5361
|
||||
LogStash::SETTINGS.register(LogStash::Setting::String.new("path.settings", ::File.join(LogStash::Environment::LOGSTASH_HOME, "config")))
|
||||
|
||||
# Node Settings
|
||||
option ["-n", "--node.name"], "NAME",
|
||||
|
@ -129,7 +135,9 @@ class LogStash::Runner < Clamp::StrictCommand
|
|||
|
||||
def run(args)
|
||||
settings_path = fetch_settings_path(args)
|
||||
|
||||
@settings.set("path.settings", settings_path) if settings_path
|
||||
|
||||
LogStash::SETTINGS.from_yaml(LogStash::SETTINGS.get("path.settings"))
|
||||
super(*[args])
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue