chronon_backend_postgres/
bootstrap.rs1use chronon_core::Result;
4
5use crate::PostgresSchedulerStore;
6
7#[must_use]
12pub fn postgres_test_url() -> String {
13 std::env::var("CHRONON_POSTGRES_URL")
14 .or_else(|_| std::env::var("CHRONON_TEST_POSTGRES_URL"))
15 .unwrap_or_else(|_| "postgres://localhost/chronon_test".into())
16}
17
18pub async fn postgres_store_from_env() -> Result<PostgresSchedulerStore> {
26 let url = postgres_test_url();
27 if let Ok(schema) = std::env::var("CHRONON_POSTGRES_SCHEMA") {
28 if std::env::var("CHRONON_POSTGRES_SKIP_BOOTSTRAP").is_ok() {
29 PostgresSchedulerStore::attach_isolated(&url, &schema).await
30 } else {
31 PostgresSchedulerStore::connect_isolated(&url, &schema).await
32 }
33 } else {
34 PostgresSchedulerStore::connect(&url).await
35 }
36}