# HG changeset patch # User Matthew Wild # Date 1294401468 0 # Node ID 3b991ceb228edb593632cfde297c1143b2272929 # Parent 6ad7ed619d37cefba8440f9c64bed11c9695f655 mod_storage_sql: Make the 'database' value for the SQLite3 driver relative to the data path diff -r 6ad7ed619d37 -r 3b991ceb228e plugins/mod_storage_sql.lua --- a/plugins/mod_storage_sql.lua Fri Jan 07 11:56:52 2011 +0000 +++ b/plugins/mod_storage_sql.lua Fri Jan 07 11:57:48 2011 +0000 @@ -32,11 +32,18 @@ local host,user,store = module.host; local params = module:get_option("sql"); +local resolve_relative_path = require "core.configmanager".resolve_relative_path; + do -- process options to get a db connection local DBI = require "DBI"; - params = params or { driver = "SQLite3", database = "prosody.sqlite" }; - assert(params.driver and params.database, "invalid params"); + params = params or { driver = "SQLite3" }; + + if params.driver == "SQLite3" then + params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); + end + + assert(params.driver and params.database, "Both the SQL driver and the database need to be specified"); prosody.unlock_globals(); local dbh, err = DBI.Connect(