aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/aggregator/.env.example1
-rw-r--r--crates/aggregator/src/main.rs8
-rw-r--r--crates/configuration/.env.example1
-rw-r--r--crates/configuration/src/main.rs8
-rw-r--r--crates/pseudonyms/.env.example1
-rw-r--r--crates/warden/.env.example1
-rw-r--r--crates/warden/src/main.rs8
7 files changed, 25 insertions, 3 deletions
diff --git a/crates/aggregator/.env.example b/crates/aggregator/.env.example
new file mode 100644
index 0000000..5178bd5
--- /dev/null
+++ b/crates/aggregator/.env.example
@@ -0,0 +1 @@
+DATABASE_URL=postgres://postgres:password@localhost:5432/evaluations
diff --git a/crates/aggregator/src/main.rs b/crates/aggregator/src/main.rs
index 62af544..7bb5a79 100644
--- a/crates/aggregator/src/main.rs
+++ b/crates/aggregator/src/main.rs
@@ -4,7 +4,7 @@ mod state;
use anyhow::Result;
use clap::Parser;
-use tracing::error;
+use tracing::{error, trace};
use warden_stack::{Configuration, Services, tracing::Tracing};
use crate::state::AppState;
@@ -78,6 +78,12 @@ async fn main() -> Result<()> {
let state = AppState::create(services, &config).await?;
+ trace!("running migrations");
+ sqlx::migrate!("./migrations")
+ .run(&state.services.postgres)
+ .await?;
+ trace!("migrations updated");
+
processor::serve(state, provider).await?;
Ok(())
diff --git a/crates/configuration/.env.example b/crates/configuration/.env.example
new file mode 100644
index 0000000..9581956
--- /dev/null
+++ b/crates/configuration/.env.example
@@ -0,0 +1 @@
+DATABASE_URL=postgres://postgres:password@localhost:5432/configuration
diff --git a/crates/configuration/src/main.rs b/crates/configuration/src/main.rs
index 7dc8da6..6f90b69 100644
--- a/crates/configuration/src/main.rs
+++ b/crates/configuration/src/main.rs
@@ -8,7 +8,7 @@ use crate::{server::error::AppError, state::AppState};
use axum::http::header::CONTENT_TYPE;
use clap::Parser;
use tower::{make::Shared, steer::Steer};
-use tracing::{error, info};
+use tracing::{error, info, trace};
use warden_stack::{Configuration, Services, tracing::Tracing};
/// warden-config
@@ -82,6 +82,12 @@ async fn main() -> Result<(), AppError> {
)
.await?;
+ trace!("running migrations");
+ sqlx::migrate!("./migrations")
+ .run(&state.services.postgres)
+ .await?;
+ trace!("migrations updated");
+
let (app, grpc_server) = server::serve(state)?;
let service = Steer::new(
diff --git a/crates/pseudonyms/.env.example b/crates/pseudonyms/.env.example
new file mode 100644
index 0000000..3728d42
--- /dev/null
+++ b/crates/pseudonyms/.env.example
@@ -0,0 +1 @@
+DATABASE_URL=postgres://postgres:password@localhost:5432/pseudonyms
diff --git a/crates/warden/.env.example b/crates/warden/.env.example
new file mode 100644
index 0000000..6caf00a
--- /dev/null
+++ b/crates/warden/.env.example
@@ -0,0 +1 @@
+DATABASE_URL=postgres://postgres:password@localhost:5432/transaction_history
diff --git a/crates/warden/src/main.rs b/crates/warden/src/main.rs
index 9e33700..90fedfd 100644
--- a/crates/warden/src/main.rs
+++ b/crates/warden/src/main.rs
@@ -7,7 +7,7 @@ mod version;
use std::net::{Ipv6Addr, SocketAddr};
use clap::{Parser, command};
-use tracing::{error, info};
+use tracing::{error, info, trace};
use warden_stack::{Configuration, Services, tracing::Tracing};
use crate::state::AppState;
@@ -79,6 +79,12 @@ async fn main() -> Result<(), error::AppError> {
let state = AppState::create(services, &config).await?;
+ trace!("running migrations");
+ sqlx::migrate!("./migrations")
+ .run(&state.services.postgres)
+ .await?;
+ trace!("migrations updated");
+
let addr = SocketAddr::from((Ipv6Addr::UNSPECIFIED, config.application.port));
let listener = tokio::net::TcpListener::bind(addr).await?;