mirror of https://github.com/mastodon/flodgatt
Temporarily remove Postgres SSL support (#45)
Remove Postgres SSL support, which was not working at the moment and was preventing flogatt from running on servers without openssl. We should re-enable SSL support at a later time.
This commit is contained in:
parent
0a8abde664
commit
7fb7a3e5c9
|
@ -308,7 +308,6 @@ dependencies = [
|
||||||
"futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"postgres 0.16.0-rc.2 (git+https://github.com/sfackler/rust-postgres.git)",
|
"postgres 0.16.0-rc.2 (git+https://github.com/sfackler/rust-postgres.git)",
|
||||||
"postgres-openssl 0.2.0-rc.1 (git+https://github.com/sfackler/rust-postgres.git)",
|
"postgres-openssl 0.2.0-rc.1 (git+https://github.com/sfackler/rust-postgres.git)",
|
||||||
"pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -19,7 +19,6 @@ postgres = { git = "https://github.com/sfackler/rust-postgres.git" }
|
||||||
uuid = { version = "0.7", features = ["v4"] }
|
uuid = { version = "0.7", features = ["v4"] }
|
||||||
dotenv = "0.14.0"
|
dotenv = "0.14.0"
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
openssl = "0.10.24"
|
|
||||||
postgres-openssl = { git = "https://github.com/sfackler/rust-postgres.git"}
|
postgres-openssl = { git = "https://github.com/sfackler/rust-postgres.git"}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn default(var: &str, default_var: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref POSTGRES_ADDR: String = match &env::var("POSTGRESS_ADDR") {
|
static ref POSTGRES_ADDR: String = match &env::var("POSTGRES_ADDR") {
|
||||||
Ok(url) => {
|
Ok(url) => {
|
||||||
warn!("DATABASE_URL env variable set. Trying to connect to Postgres with that URL instead of any values set in DB_HOST, DB_USER, DB_NAME, DB_PASS, or DB_PORT.");
|
warn!("DATABASE_URL env variable set. Trying to connect to Postgres with that URL instead of any values set in DB_HOST, DB_USER, DB_NAME, DB_PASS, or DB_PORT.");
|
||||||
url.to_string()
|
url.to_string()
|
||||||
|
@ -113,12 +113,13 @@ pub fn logging_and_env() {
|
||||||
|
|
||||||
/// Configure Postgres and return a connection
|
/// Configure Postgres and return a connection
|
||||||
pub fn postgres() -> postgres::Client {
|
pub fn postgres() -> postgres::Client {
|
||||||
use openssl::ssl::{SslConnector, SslMethod};
|
// use openssl::ssl::{SslConnector, SslMethod};
|
||||||
use postgres_openssl::MakeTlsConnector;
|
// use postgres_openssl::MakeTlsConnector;
|
||||||
let mut builder = SslConnector::builder(SslMethod::tls()).unwrap();
|
// let mut builder = SslConnector::builder(SslMethod::tls()).unwrap();
|
||||||
builder.set_ca_file("/etc/ssl/cert.pem").unwrap();
|
// builder.set_ca_file("/etc/ssl/cert.pem").unwrap();
|
||||||
let connector = MakeTlsConnector::new(builder.build());
|
// let connector = MakeTlsConnector::new(builder.build());
|
||||||
postgres::Client::connect(&POSTGRES_ADDR.to_string(), connector)
|
// TODO: add TLS support, remove `NoTls`
|
||||||
|
postgres::Client::connect(&POSTGRES_ADDR.to_string(), postgres::NoTls)
|
||||||
.expect("Can connect to local Postgres")
|
.expect("Can connect to local Postgres")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue