ontohub_config.rb revision 664a966954a0d661e25577d2e7f74c12bcb67c9f
904N/Arequire 'yaml'
904N/Arequire 'singleton'
904N/A
904N/Aclass OntohubConfig
904N/A include Singleton
904N/A
904N/A attr_reader :config
904N/A
904N/A def initialize
904N/A @config = {} #YAML.load_file(File.join(ROOT_PATH, 'config.yml'))
904N/A end
904N/A
904N/A def git_user
904N/A @config['git_user'] ||= "git"
904N/A end
904N/A
904N/A def git_home
904N/A @config['git_home'] ||= "/home/#{git_user}"
904N/A end
904N/A
4171N/A def repos_path
904N/A @config['repos_path'] ||= "#{git_home}/repositories"
904N/A end
904N/A
904N/A def auth_file
904N/A @config['auth_file'] ||= "#{git_home}/.ssh/authorized_keys"
904N/A end
904N/A
904N/A def ontohub_url
904N/A @config['ontohub_url'] ||= "http://localhost/"
904N/A end
904N/A
904N/A def http_settings
904N/A @config['http_settings'] ||= {}
904N/A end
904N/A
904N/A def redis
904N/A @config['redis'] ||= {}
904N/A end
904N/A
4171N/A def redis_namespace
4171N/A redis['namespace'] || 'ontohub'
4171N/A end
4171N/A
4171N/A def log_file
4171N/A @config['log_file'] ||= File.join(ROOT_PATH, '../log/git.log')
end
def log_level
@config['log_level'] ||= 'INFO'
end
def audit_usernames
@config['audit_usernames'] ||= false
end
# Build redis command to write update event in ontohub queue
def redis_command
if redis.empty?
# Default to old method of connecting to redis
# for users that haven't updated their configuration
"env -i redis-cli"
else
if redis.has_key?("socket")
"#{redis['bin']} -s #{redis['socket']}"
else
"#{redis['bin']} -h #{redis['host']} -p #{redis['port']}"
end
end
end
end