Compare commits

...

1 Commits

Author SHA1 Message Date
Mark Sinclair 1678fb6b94 Data Observatory: add env var PG_CERT and bump version 2026-02-19 17:08:06 +00:00
3 changed files with 12 additions and 3 deletions
Generated
+1 -1
View File
@@ -6209,7 +6209,7 @@ dependencies = [
[[package]]
name = "nym-data-observatory"
version = "1.0.1"
version = "1.0.2"
dependencies = [
"anyhow",
"async-trait",
+1 -1
View File
@@ -3,7 +3,7 @@
[package]
name = "nym-data-observatory"
version = "1.0.1"
version = "1.0.2"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
+10 -1
View File
@@ -1,5 +1,6 @@
use anyhow::{Result, anyhow};
use sqlx::{Postgres, migrate::Migrator, postgres::PgConnectOptions};
use std::env;
use std::str::FromStr;
use tracing::info;
@@ -19,7 +20,15 @@ pub(crate) struct Storage {
impl Storage {
pub async fn init(connection_url: String) -> Result<Self> {
let connect_options = PgConnectOptions::from_str(&connection_url)?;
let mut connect_options = PgConnectOptions::from_str(&connection_url)?;
let ssl_cert_path = env::var("PG_CERT").ok();
if let Some(ssl_cert) = ssl_cert_path {
connect_options = connect_options
.ssl_mode(sqlx::postgres::PgSslMode::Require)
.ssl_root_cert(ssl_cert);
}
let pool = DbPool::connect_with(connect_options)
.await