From b76d1bcc4d135f0d46a1f5daa54a0faa939cfd20 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 5 Aug 2014 15:11:33 -0700 Subject: added kkp_ca_file config option --- lib/nickserver/config.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/nickserver/config.rb b/lib/nickserver/config.rb index 31fbfea..0f44b79 100644 --- a/lib/nickserver/config.rb +++ b/lib/nickserver/config.rb @@ -9,6 +9,7 @@ module Nickserver class << self attr_accessor :hkp_url + attr_accessor :hkp_ca_file attr_accessor :couch_port attr_accessor :couch_host attr_accessor :couch_database @@ -32,10 +33,27 @@ module Nickserver end true end + self.validate end private + def self.validate + if @hkp_ca_file + # look for the hkp_ca_file either by absolute path or relative to nickserver gem root + [@hkp_ca_file, File.expand_path(@hkp_ca_file, "#{__FILE__}/../../../")].each do |file| + if File.exists?(file) + @hkp_ca_file = file + break + end + end + unless File.exists?(@hkp_ca_file) + STDERR.puts "ERROR in configuration: cannot find hkp_ca_file `#{@hkp_ca_file}`" + exit(1) + end + end + end + def self.load_config(file_path) begin YAML.load(File.read(file_path)).each do |key, value| -- cgit v1.2.3