Inject version string into manifold
This commit is contained in:
parent
58b4caea0d
commit
74a3223032
|
|
@ -1,3 +1,2 @@
|
||||||
/target
|
/target
|
||||||
*.db
|
*.db
|
||||||
Cargo.lock
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,31 +1,21 @@
|
||||||
use std::io::stdout;
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use diesel::sqlite::Sqlite;
|
|
||||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
|
||||||
use poise::serenity_prelude as serenity;
|
|
||||||
|
|
||||||
use manifold::config::ManifoldConfig;
|
|
||||||
use manifold::{ManifoldDatabase, ManifoldDatabasePool};
|
|
||||||
use poise::serenity_prelude::GatewayIntents;
|
use poise::serenity_prelude::GatewayIntents;
|
||||||
|
use crate::built_info;
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
|
||||||
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn run(arguments: ArgMatches) {
|
pub async fn run(arguments: ArgMatches) {
|
||||||
let mut client = match manifold::prepare_client(arguments, GatewayIntents::all(), commands::collect_commands()).await {
|
let git_info: String = built_info::GIT_VERSION.unwrap_or("unknown").to_string();
|
||||||
|
let version_string = format!("Badgey Bot version {ver} built at {time} from revision {rev}", ver=built_info::PKG_VERSION, time=built_info::BUILT_TIME_UTC, rev=git_info);
|
||||||
|
|
||||||
|
let client = match manifold::prepare_client(arguments, GatewayIntents::all(), commands::collect_commands(), version_string).await {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error preparing client; {:?}", e);
|
error!("Error preparing client; {:?}", e);
|
||||||
panic!("Error preparing client!");
|
panic!("Error preparing client!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
client.build().await.unwrap().start().await;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn apply_migrations(conn: &mut impl MigrationHarness<Sqlite>) {
|
let _ = client.build().await.unwrap().start().await;
|
||||||
|
|
||||||
conn.run_pending_migrations(MIGRATIONS)
|
|
||||||
.expect("An error occurred applying migrations.");
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue