aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_storage_sql.lua')
-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(