···11-use cynthia_con::{CynthiaColors, CynthiaStyles};
21use crate::errors::LuminaError::{self, ConfMissing};
22+use cynthia_con::{CynthiaColors, CynthiaStyles};
33use r2d2::Pool;
44-use r2d2_sqlite;
54use r2d2_sqlite::SqliteConnectionManager;
65use tokio_postgres as postgres;
76use tokio_postgres::tls::NoTlsStream;
···130129131130 c => {
132131 println!("{:?}", c);
133133- Err(LuminaError::ConfInvalid(
134134-format!("LUMINA_DB_TYPE does not contain a valid value, only 'sqlite' or 'postgres' are allowed. Found: {}", c)
135135-136136- ))
132132+ Err(LuminaError::ConfInvalid(format!(
133133+ "LUMINA_DB_TYPE does not contain a valid value, only 'sqlite' or 'postgres' are allowed. Found: {}",
134134+ c
135135+ )))
137136 }
138137 }
139138}
+33-9
server/src/main.rs
···7171 process::exit(1);
7272 }
7373 Err(LuminaError::Sqlite(a)) => {
7474- eprintln!("{} While opening sqlite database: {}", "[ERROR]".color_error_red().style_bold(),a);
7474+ eprintln!(
7575+ "{} While opening sqlite database: {}",
7676+ "[ERROR]".color_error_red().style_bold(),
7777+ a
7878+ );
7579 process::exit(1);
7680 }
7781 Err(LuminaError::Postgres(a)) => {
7878- eprintln!("{} While connecting to postgres database: {}", "[ERROR]".color_error_red().style_bold(), a);
8282+ eprintln!(
8383+ "{} While connecting to postgres database: {}",
8484+ "[ERROR]".color_error_red().style_bold(),
8585+ a
8686+ );
7987 process::exit(1);
8088 }
8189 Err(_) => {
8282- eprintln!("{} Unknown error: could not setup database connection.", "[ERROR]".color_error_red().style_bold());
9090+ eprintln!(
9191+ "{} Unknown error: could not setup database connection.",
9292+ "[ERROR]".color_error_red().style_bold()
9393+ );
8394 process::exit(1);
8495 }
8596 };
···110121 match result {
111122 Ok(_) => {}
112123 Err(LuminaError::RocketFaillure(e)) => {
113113- eprintln!("{} Error starting server: {:?}", "[ERROR]".color_error_red().style_bold(), e);
124124+ eprintln!(
125125+ "{} Error starting server: {:?}",
126126+ "[ERROR]".color_error_red().style_bold(),
127127+ e
128128+ );
114129 }
115130 Err(_) => {
116116- eprintln!("{} Unknown error starting server.", "[ERROR]".color_error_red().style_bold());
131131+ eprintln!(
132132+ "{} Unknown error starting server.",
133133+ "[ERROR]".color_error_red().style_bold()
134134+ );
117135 }
118136 }
119137 }
120138 Err(LuminaError::ConfMissing(a)) => {
121139 eprintln!(
122140 "{} Missing environment variable {}, which is required to continue. Please make sure it is set, or change other variables to make it redundant, if possible.",
123123- "[ERROR]".color_error_red().style_bold()
124124- ,
141141+ "[ERROR]".color_error_red().style_bold(),
125142 a.color_bright_orange()
126143 );
127144 process::exit(1);
128145 }
129146 Err(LuminaError::ConfInvalid(a)) => {
130130- eprintln!("{} Invalid environment variable: {}", "[ERROR]".color_error_red().style_bold(),a.color_bright_orange());
147147+ eprintln!(
148148+ "{} Invalid environment variable: {}",
149149+ "[ERROR]".color_error_red().style_bold(),
150150+ a.color_bright_orange()
151151+ );
131152 process::exit(1);
132153 }
133154 Err(_) => {
134134- eprintln!("{} Unknown error: could not setup server configuration.", "[ERROR]".color_error_red().style_bold());
155155+ eprintln!(
156156+ "{} Unknown error: could not setup server configuration.",
157157+ "[ERROR]".color_error_red().style_bold()
158158+ );
135159 process::exit(1);
136160 }
137161 };