Software / code / prosody
Comparison
plugins/mod_storage_sql2.lua @ 6746:5e8a8319699d
mod_storage_sql2: Validate configuration after normalizing SQLite3 database path (fixes traceback with default config)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 27 Jun 2015 15:59:37 +0200 |
| parent | 6740:99b3f29c3c71 |
| child | 6749:9dc05d3efdc9 |
| child | 6754:c72b00dade25 |
comparison
equal
deleted
inserted
replaced
| 6744:79318d548465 | 6746:5e8a8319699d |
|---|---|
| 377 end | 377 end |
| 378 end | 378 end |
| 379 end | 379 end |
| 380 | 380 |
| 381 local function normalize_params(params) | 381 local function normalize_params(params) |
| 382 assert(params.driver and params.database, "Configuration error: Both the SQL driver and the database need to be specified"); | |
| 383 if params.driver == "SQLite3" then | 382 if params.driver == "SQLite3" then |
| 384 params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); | 383 params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); |
| 385 end | 384 end |
| 385 assert(params.driver and params.database, "Configuration error: Both the SQL driver and the database need to be specified"); | |
| 386 return params; | 386 return params; |
| 387 end | 387 end |
| 388 | 388 |
| 389 function module.load() | 389 function module.load() |
| 390 if prosody.prosodyctl then return; end | 390 if prosody.prosodyctl then return; end |