Sha256: 541b5bc86e4fb490de1426685650349ed5a54b50bf3828564e8a3c37db5cbe4b
Contents?: true
Size: 898 Bytes
Versions: 30
Compression:
Stored size: 898 Bytes
Contents
module Nexmo module OAS module Renderer module Filters class DynamicContent < Banzai::Filter def call(input) input.gsub(/(\s|^)\[\~(.+?)\~\](\s|$)/) do content = environment_value($2) || config_value($2) || "VALUE NOT SET: #{$2}" "#{$1}#{content}#{$3}" end end private def environment_value(key) return nil unless ENV['DYNAMIC_CONTENT'] @environment_dynamic_content ||= YAML.safe_load(ENV['DYNAMIC_CONTENT']) @environment_dynamic_content ||= YAML.safe_load(temp) @environment_dynamic_content[key] end def config_value(key) @config_dynamic_content ||= YAML.load_file("#{API.root}/config/dynamic_content.yml") @config_dynamic_content[key] end end end end end end
Version data entries
30 entries across 30 versions & 1 rubygems