diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-01-07 11:59:05 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-01-07 11:59:05 +0000 |
commit | 4fac07320796a04ea2596f7c0ceaabaa608bd532 (patch) | |
tree | abd3446bd90c35e108a9336c9865f85d34eac4f5 /plugins/mod_storage_sql.lua | |
parent | 79bcb5c7cfed2a2ea89d2bac48bacb9e9447d599 (diff) | |
parent | 1453a1753f69dbfd122436fca77888328058046b (diff) | |
download | prosody-4fac07320796a04ea2596f7c0ceaabaa608bd532.tar.gz prosody-4fac07320796a04ea2596f7c0ceaabaa608bd532.zip |
Merge 0.8->trunk
Diffstat (limited to 'plugins/mod_storage_sql.lua')
-rw-r--r-- | plugins/mod_storage_sql.lua | 11 |
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( |