Sha256: acb4cc293bbe56b8fc071505b6c599a9f9e71c3db21fa753e4f339961de0e2b6

Contents?: true

Size: 1.62 KB

Versions: 59

Compression:

Stored size: 1.62 KB

Contents

#
# Fluentd
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#

require 'fluent/config/yaml_parser/loader'
require 'fluent/config/yaml_parser/parser'
require 'pathname'

module Fluent
  module Config
    module YamlParser
      def self.parse(path)
        context = Kernel.binding

        unless context.respond_to?(:use_nil)
          context.define_singleton_method(:use_nil) do
            raise Fluent::SetNil
          end
        end

        unless context.respond_to?(:use_default)
          context.define_singleton_method(:use_default) do
            raise Fluent::SetDefault
          end
        end

        unless context.respond_to?(:hostname)
          context.define_singleton_method(:hostname) do
            Socket.gethostname
          end
        end

        unless context.respond_to?(:worker_id)
          context.define_singleton_method(:worker_id) do
            ENV['SERVERENGINE_WORKER_ID'] || ''
          end
        end

        s = Fluent::Config::YamlParser::Loader.new(context).load(Pathname.new(path))
        Fluent::Config::YamlParser::Parser.new(s).build.to_element
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 7 rubygems

Version Path
fluentd-1.16.0 lib/fluent/config/yaml_parser.rb
fluentd-1.15.3-x86-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.3-x64-mingw-ucrt lib/fluent/config/yaml_parser.rb
fluentd-1.15.3-x64-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.3 lib/fluent/config/yaml_parser.rb
fluentd-1.15.2-x86-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.2-x64-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.2-x64-mingw-ucrt lib/fluent/config/yaml_parser.rb
fluentd-1.15.2 lib/fluent/config/yaml_parser.rb
fluentd-1.15.1-x86-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.1-x64-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.1-x64-mingw-ucrt lib/fluent/config/yaml_parser.rb
fluentd-1.15.1 lib/fluent/config/yaml_parser.rb
fluentd-1.15.0-x86-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.0-x64-mingw-ucrt lib/fluent/config/yaml_parser.rb
fluentd-1.15.0-x64-mingw32 lib/fluent/config/yaml_parser.rb
fluentd-1.15.0 lib/fluent/config/yaml_parser.rb
dtomasgu-fluentd-1.14.8.pre.dev lib/fluent/config/yaml_parser.rb
dtomasgu-fluentd-1.14.7.pre.dev lib/fluent/config/yaml_parser.rb