aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src/database.rs
diff options
context:
space:
mode:
authorTeddy Wing2018-11-09 19:47:46 +0100
committerTeddy Wing2018-11-09 19:47:46 +0100
commit6aa6c70af607ede55f9dafef7278b192a2a6b9d0 (patch)
tree1afcc1fbe7479c8c2028768f84fce2f2658083dd /license-generator/src/database.rs
parente8aa1429fa45957a2174446df64b62d407544d8b (diff)
downloaddome-key-web-6aa6c70af607ede55f9dafef7278b192a2a6b9d0.tar.bz2
Set up a file logger
Get a file path from the `LOG_FILE` environment variable and use it for log output. Call `database::get_database_connection()` and log the error if it fails. Worried about exiting early from the FastCGI program, as DreamHost says this causes problems (https://help.dreamhost.com/hc/en-us/articles/217298967). But I don't see how the program can continue without a database connection. Return a `Result` from `main()` because it's easier to use the `?` operator for errors that happen before logging is initialised.
Diffstat (limited to 'license-generator/src/database.rs')
-rw-r--r--license-generator/src/database.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/license-generator/src/database.rs b/license-generator/src/database.rs
index 28673c4..94e925f 100644
--- a/license-generator/src/database.rs
+++ b/license-generator/src/database.rs
@@ -4,7 +4,7 @@ use mysql;
use errors::*;
-fn get_database_connection() -> Result<mysql::PooledConn> {
+pub fn get_database_connection() -> Result<mysql::PooledConn> {
let connection_url = env::var("DATABASE_URL")?;
let pool = mysql::Pool::new_manual(10, 50, connection_url)?;
let cx = pool.get_conn()?;