bd94dd3055
* Store wireguard peers in db * Add update to nym-node * Move gateway-requests and gateway-storage to common * Carry storage to PeerController field * Double kernel modifications with storage ones * Take storage peers at boot * Link storage query for registration flow * Move authenticator peer comms in peer manager * Modify template too * Remove unused * Fix clippy * Fix clippy non-linux * Keep storage data up-to-date on every check * Check for staleness in storage timestamps * Remove potential for panic in unwrap * Fix clippy * Fmt * Clippy after rebase * Remove in memory test structure
29 lines
993 B
Rust
29 lines
993 B
Rust
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
use sqlx::{Connection, SqliteConnection};
|
|
use std::env;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
|
let database_path = format!("{}/gateway-example.sqlite", out_dir);
|
|
|
|
let mut conn = SqliteConnection::connect(&format!("sqlite://{}?mode=rwc", database_path))
|
|
.await
|
|
.expect("Failed to create SQLx database connection");
|
|
|
|
sqlx::migrate!("./migrations")
|
|
.run(&mut conn)
|
|
.await
|
|
.expect("Failed to perform SQLx migrations");
|
|
|
|
#[cfg(target_family = "unix")]
|
|
println!("cargo:rustc-env=DATABASE_URL=sqlite://{}", &database_path);
|
|
|
|
#[cfg(target_family = "windows")]
|
|
// for some strange reason we need to add a leading `/` to the windows path even though it's
|
|
// not a valid windows path... but hey, it works...
|
|
println!("cargo:rustc-env=DATABASE_URL=sqlite:///{}", &database_path);
|
|
}
|