aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-01-07 11:57:48 +0000
committerMatthew Wild <mwild1@gmail.com>2011-01-07 11:57:48 +0000
commit1453a1753f69dbfd122436fca77888328058046b (patch)
treee2333885b913cc71a48b5c52a3c6c29640966e9a
parent371cf4887ae3a57e6c6832cb7781e10bb926d009 (diff)
downloadprosody-1453a1753f69dbfd122436fca77888328058046b.tar.gz
prosody-1453a1753f69dbfd122436fca77888328058046b.zip
mod_storage_sql: Make the 'database' value for the SQLite3 driver relative to the data path
-rw-r--r--plugins/mod_storage_sql.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 3afbab1c..63f75991 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -32,11 +32,18 @@ local connection;
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(