mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 19:06:12 +02:00
Refactor: decide fluentd-ui data directory logic to FluentdUI class
This commit is contained in:
parent
67d26bdc3c
commit
c8f8a62c23
@ -46,13 +46,7 @@ class Fluentd
|
||||
end
|
||||
|
||||
def self.json_path
|
||||
if ENV["FLUENTD_UI_DATA_DIR"].present?
|
||||
dir = ENV["FLUENTD_UI_DATA_DIR"]
|
||||
else
|
||||
dir = ENV["HOME"] + "/.fluentd-ui/core_data"
|
||||
end
|
||||
FileUtils.mkdir_p(dir)
|
||||
dir + "/#{Rails.env}-fluentd.json"
|
||||
FluentdUI.data_dir + "/#{Rails.env}-fluentd.json"
|
||||
end
|
||||
|
||||
def fluentd?
|
||||
|
||||
@ -19,4 +19,10 @@ module FluentdUI
|
||||
return nil unless setup_fluentd
|
||||
setup_fluentd.agent.version
|
||||
end
|
||||
|
||||
def self.data_dir
|
||||
dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data"
|
||||
FileUtils.mkdir_p(dir) # ensure directory exists
|
||||
dir
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user