feat: Enable Docker deployment and CD
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 8m1s

Closes #8, partially addresses #6
This commit is contained in:
2023-11-25 16:55:31 +01:00
parent d789ea7e74
commit 60a81f66a8
8 changed files with 147 additions and 33 deletions

View File

@@ -4,7 +4,7 @@ use std::env;
use poise::serenity_prelude::{ChannelId, GuildId};
use sqlx::SqlitePool;
use tracing::error;
use tracing::{error, info};
pub type Result<T> = ::std::result::Result<T, sqlx::Error>;
@@ -24,14 +24,12 @@ impl Database {
///
/// This function will return an error if the Sqlite pool fails to
/// create.
// TODO: Create the database if it doesnt exist already and run migrations
pub async fn new() -> Result<Self> {
Ok(Self(
SqlitePool::connect(
&env::var("DATABASE_URL")
.expect("Missing enviroment variable DATABASE_URL"),
)
.await?,
))
let db_url = env::var("DATABASE_URL")
.expect("Missing enviroment variable DATABASE_URL");
info!("Connecting to database located at {db_url}");
Ok(Self(SqlitePool::connect(&db_url).await?))
}
/// Return from database all channels registered as loggers for a