You've already forked AstralRinth
forked from didirus/AstralRinth
* Add redis caching to getting a user's project ids * Run `cargo sqlx prepare` to update the sqlx-data.json * Add redis caching for getting user notifications * Fix new clippy warnings * Remove log that shouldn't have been committed * Batch insert of notifications (untested) * sqlx prepare... * Fix merge conflict things and use new redis struct * Fix bug with calling delete_many without any elements (caught by tests) * cargo sqlx prepare * Add tests around cache invalidation (and fix bug they caught!) * Some test reorg based on code review suggestions
44 lines
1.2 KiB
Rust
44 lines
1.2 KiB
Rust
use labrinth::{check_env_vars, clickhouse};
|
|
use labrinth::{file_hosting, queue, LabrinthConfig};
|
|
use std::sync::Arc;
|
|
|
|
use self::database::TemporaryDatabase;
|
|
|
|
pub mod actix;
|
|
pub mod api_v2;
|
|
pub mod asserts;
|
|
pub mod database;
|
|
pub mod dummy_data;
|
|
pub mod environment;
|
|
pub mod pats;
|
|
pub mod request_data;
|
|
pub mod scopes;
|
|
|
|
// Testing equivalent to 'setup' function, producing a LabrinthConfig
|
|
// If making a test, you should probably use environment::TestEnvironment::build_with_dummy() (which calls this)
|
|
pub async fn setup(db: &TemporaryDatabase) -> LabrinthConfig {
|
|
println!("Setting up labrinth config");
|
|
|
|
dotenvy::dotenv().ok();
|
|
|
|
if check_env_vars() {
|
|
println!("Some environment variables are missing!");
|
|
}
|
|
|
|
let pool = db.pool.clone();
|
|
let redis_pool = db.redis_pool.clone();
|
|
let file_host: Arc<dyn file_hosting::FileHost + Send + Sync> =
|
|
Arc::new(file_hosting::MockHost::new());
|
|
let mut clickhouse = clickhouse::init_client().await.unwrap();
|
|
|
|
let maxmind_reader = Arc::new(queue::maxmind::MaxMindIndexer::new().await.unwrap());
|
|
|
|
labrinth::app_setup(
|
|
pool.clone(),
|
|
redis_pool.clone(),
|
|
&mut clickhouse,
|
|
file_host.clone(),
|
|
maxmind_reader.clone(),
|
|
)
|
|
}
|