mirror of
https://github.com/bitwarden/server
synced 2026-01-30 16:23:37 +00:00
Smallest possible test of sql server with a publisher crate
This commit is contained in:
25
akd/crates/publisher/Cargo.toml
Normal file
25
akd/crates/publisher/Cargo.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "publisher"
|
||||
edition.workspace = true
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
license-file.workspace = true
|
||||
keywords.workspace = true
|
||||
|
||||
[dependencies]
|
||||
akd_storage = { path = "../akd_storage" }
|
||||
tokio-util = {version = "0.7.16", features = ["compat"] }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
async-std = {version = "1.13.2", features = ["attributes"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
tiberius = { version = "0.12.3", default-features = false, features = ["chrono", "tokio", "rustls"] }
|
||||
|
||||
[target.'cfg(not(target_os = "macos"))'.workspace.dependencies]
|
||||
tiberius = { version = "0.12.3", features = ["chrono", "tokio"] }
|
||||
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
19
akd/crates/publisher/src/main.rs
Normal file
19
akd/crates/publisher/src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use tracing::{info, trace};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(tracing::Level::TRACE)
|
||||
.init();
|
||||
|
||||
// Read connection string from env var
|
||||
let connection_string = std::env::var("AKD_MSSQL_CONNECTION_STRING").expect("AKD_MSSQL_CONNECTION_STRING must be set.");
|
||||
|
||||
let mssql = akd_storage::ms_sql::MsSql::builder(connection_string)
|
||||
.pool_size(10)
|
||||
.build()
|
||||
.await
|
||||
.expect("Failed to create MsSql instance");
|
||||
|
||||
mssql.migrate().await.expect("Failed to run migrations");
|
||||
}
|
||||
Reference in New Issue
Block a user