summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-08-05 15:11:33 -0700
committerelijah <elijah@riseup.net>2014-08-05 15:11:33 -0700
commitb76d1bcc4d135f0d46a1f5daa54a0faa939cfd20 (patch)
treeeaf766b279a5fd69899b665adea0ca433b37d9d5 /lib
parent4af55c774c0d47462fffe0600c8204bbc23224ed (diff)
added kkp_ca_file config option
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver/config.rb18
1 files changed, 18 insertions, 0 deletions
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|