summaryrefslogtreecommitdiff
path: root/lib/nickserver/config.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2016-06-15 14:22:08 +0200
committerGitHub <noreply@github.com>2016-06-15 14:22:08 +0200
commit3c6dc3d7b902b46b82a3d8cd38bd3fa896024beb (patch)
tree559b3998465248138b6f24a76b6b3e55e60f3986 /lib/nickserver/config.rb
parent5cad637a4a2a3de6b95ff1204fc29174e18b3124 (diff)
parent93258bd6fe6247e7af67f423243eba9808e920ee (diff)
Merge pull request #3 from azul/refactor/transport-adapters
Refactor em specifics into http adapter
Diffstat (limited to 'lib/nickserver/config.rb')
-rw-r--r--lib/nickserver/config.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/nickserver/config.rb b/lib/nickserver/config.rb
index 46b6bef..b1def7c 100644
--- a/lib/nickserver/config.rb
+++ b/lib/nickserver/config.rb
@@ -36,6 +36,21 @@ module Nickserver
self.validate
end
+ def self.couch_url
+ [ 'http://',
+ couch_auth,
+ couch_host,
+ ':',
+ couch_port,
+ '/',
+ couch_database
+ ].join
+ end
+
+ def self.couch_auth
+ "#{couch_user}:#{couch_password}@" if couch_user
+ end
+
private
def self.validate
@@ -59,7 +74,7 @@ module Nickserver
YAML.load(File.read(file_path)).each do |key, value|
begin
self.send("#{key}=", value)
- rescue NoMethodError => exc
+ rescue NoMethodError
STDERR.puts "ERROR in file #{file_path}, '#{key}' is not a valid option"
exit(1)
end