class Pansophy::ConfigSynchronizer

Attributes

config_bucket_name[W]
config_local_folder[W]
config_remote_folder[W]
version[W]

Public Instance Methods

config_bucket_name() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 12
def config_bucket_name
  @config_bucket_name ||= ENV['CONFIG_BUCKET_NAME']
end
config_local_folder() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 20
def config_local_folder
  @config_local_folder ||= (ENV['CONFIG_LOCAL_FOLDER'] || ConfigPath.find!)
end
config_remote_folder() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 16
def config_remote_folder
  @config_remote_folder ||= ENV.fetch('CONFIG_REMOTE_FOLDER', 'config')
end
merge() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 7
def merge
  verify_config_bucket_name!
  Pansophy.merge(config_bucket_name, remote_path, local_path, overwrite: true)
end
version() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 24
def version
  @version ||= ENV.fetch('CONFIG_VERSION', '1.0')
end

Private Instance Methods

local_path() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 34
def local_path
  config_local_folder.to_s
end
remote_path() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 30
def remote_path
  Pathname.new(config_remote_folder).join(version.to_s).to_s
end
verify_config_bucket_name!() click to toggle source
# File lib/pansophy/config_synchronizer.rb, line 38
def verify_config_bucket_name!
  return unless config_bucket_name.nil? || config_bucket_name.empty?
  fail ConfigSynchronizerError, 'CONFIG_BUCKET_NAME is undefined'
end