(postgres_connection: &str)
| 12 | |
| 13 | #[must_use] |
| 14 | pub fn return_database_connection(postgres_connection: &str) -> Client { |
| 15 | // Lets accept self signed certificates |
| 16 | let connector = TlsConnector::builder() |
| 17 | .danger_accept_invalid_certs(true) |
| 18 | .build() |
| 19 | .unwrap(); |
| 20 | let tls_connector = MakeTlsConnector::new(connector); |
| 21 | |
| 22 | match Client::connect(postgres_connection, tls_connector) { |
| 23 | Ok(client) => client, |
| 24 | Err(e) => { |
| 25 | println!("The following error happened while connecting to the database: {e}"); |
| 26 | std::process::exit(1) |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | pub fn prepare_database(postgres_connection: &str) -> Result<()> { |
| 32 | let mut connection: postgres::Client = return_database_connection(postgres_connection); |
no outgoing calls