lib/base/db.rb in logworm-0.7.0 vs lib/base/db.rb in logworm-0.7.1
- old
+ new
@@ -46,9 +46,15 @@
m = config_vars.match(Regexp.new("LOGWORM_URL\\s+=>\\s+([^\\n]+)"))
config.save(m[1]) and return DB.new(m[1]) if m and DB.parse_url(m[1])
nil
end
+
+ def self.from_config_or_die
+ db = self.from_config
+ raise "The application is not properly configured. Either use 'heroku addon:add' to add logworm to your app, or save your project's credentials into the .logworm file" unless db
+ db
+ end
def tables()
res = db_call(:get, "#{@host}/")
end