summaryrefslogtreecommitdiff
path: root/lib/nickserver
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nickserver')
-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|