summaryrefslogtreecommitdiff
path: root/lib/leap_ca.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-12 23:53:51 -0800
committerelijah <elijah@riseup.net>2012-11-12 23:53:51 -0800
commitc37a35df81b2d6becc09f1820240db24c3ec632c (patch)
tree50187e4ab1face237760614ecf844b42efdd51e1 /lib/leap_ca.rb
parentc90d30621e042cc3e52ffc87e3491ab110a57e9e (diff)
first fully working version of leap_ca
Diffstat (limited to 'lib/leap_ca.rb')
-rw-r--r--lib/leap_ca.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/leap_ca.rb b/lib/leap_ca.rb
index 9720c81..aca2925 100644
--- a/lib/leap_ca.rb
+++ b/lib/leap_ca.rb
@@ -1,3 +1,25 @@
+unless defined? BASE_DIR
+ BASE_DIR = File.expand_path('../..', __FILE__)
+end
+unless defined? LEAP_CA_CONFIG
+ LEAP_CA_CONFIG = '/etc/leap/leap_ca.yaml'
+end
+
+#
+# Load Config
+# this must come first, because CouchRest needs the connection defined before the models are defined.
+#
+require 'leap_ca/config'
+LeapCA::Config.load(BASE_DIR, 'config/config_default.yaml', LEAP_CA_CONFIG, ARGV.grep(/\.ya?ml$/).first)
+
+require 'couchrest_model'
+CouchRest::Model::Base.configure do |config|
+ config.connection = LeapCA::Config.couch_connection
+end
+
+#
+# Load LeapCA
+#
require 'leap_ca/cert'
require 'leap_ca/couch_stream'
require 'leap_ca/couch_changes'