feat: add bunny-api-tokio
This commit is contained in:
parent
a676962316
commit
cf333b4eba
3 changed files with 53 additions and 3 deletions
13
src/main.rs
13
src/main.rs
|
@ -25,9 +25,10 @@ struct Args {
|
|||
pub struct Data {
|
||||
pub pool: Pool<Postgres>,
|
||||
pub cache_pool: redis::Client,
|
||||
pub _config: Config,
|
||||
pub config: Config,
|
||||
pub argon2: Argon2<'static>,
|
||||
pub start_time: SystemTime,
|
||||
pub bunny_cdn: bunny_api_tokio::Client,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -48,6 +49,10 @@ async fn main() -> Result<(), Error> {
|
|||
|
||||
let cache_pool = redis::Client::open(config.cache_database.url())?;
|
||||
|
||||
let mut bunny_cdn = bunny_api_tokio::Client::new(config.bunny.api_key.clone()).await?;
|
||||
|
||||
bunny_cdn.storage.init(config.bunny.endpoint.clone(), config.bunny.storage_zone.clone())?;
|
||||
|
||||
/*
|
||||
TODO: Figure out if a table should be used here and if not then what.
|
||||
Also figure out if these should be different types from what they currently are and if we should add more "constraints"
|
||||
|
@ -94,7 +99,8 @@ async fn main() -> Result<(), Error> {
|
|||
uuid uuid PRIMARY KEY NOT NULL,
|
||||
owner_uuid uuid NOT NULL REFERENCES users(uuid),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
description VARCHAR(300)
|
||||
description VARCHAR(300),
|
||||
icon VARCHAR(100) DEFAULT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS guild_members (
|
||||
uuid uuid PRIMARY KEY NOT NULL,
|
||||
|
@ -164,10 +170,11 @@ async fn main() -> Result<(), Error> {
|
|||
let data = Data {
|
||||
pool,
|
||||
cache_pool,
|
||||
_config: config,
|
||||
config,
|
||||
// TODO: Possibly implement "pepper" into this (thinking it could generate one if it doesnt exist and store it on disk)
|
||||
argon2: Argon2::default(),
|
||||
start_time: SystemTime::now(),
|
||||
bunny_cdn,
|
||||
};
|
||||
|
||||
HttpServer::new(move || {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue