Make it (a tiny bit) easier to run your own collab (#9557)
* Allow creating channels when seeding * Allow configuring a custom `SEED_PATH` * Seed the database when creating/migrating it so you don't need a separate step for this. Release Notes: - N/A
This commit is contained in:
parent
1062c5bd26
commit
ac4c6c60f1
17 changed files with 246 additions and 177 deletions
|
@ -6,6 +6,7 @@ pub mod env;
|
|||
pub mod executor;
|
||||
mod rate_limiter;
|
||||
pub mod rpc;
|
||||
pub mod seed;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@ -111,6 +112,8 @@ impl std::error::Error for Error {}
|
|||
pub struct Config {
|
||||
pub http_port: u16,
|
||||
pub database_url: String,
|
||||
pub migrations_path: Option<PathBuf>,
|
||||
pub seed_path: Option<PathBuf>,
|
||||
pub database_max_connections: u32,
|
||||
pub api_token: String,
|
||||
pub clickhouse_url: Option<String>,
|
||||
|
@ -142,12 +145,6 @@ impl Config {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
pub struct MigrateConfig {
|
||||
pub database_url: String,
|
||||
pub migrations_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct AppState {
|
||||
pub db: Arc<Database>,
|
||||
pub live_kit_client: Option<Arc<dyn live_kit_server::api::Client>>,
|
||||
|
@ -162,8 +159,7 @@ impl AppState {
|
|||
pub async fn new(config: Config, executor: Executor) -> Result<Arc<Self>> {
|
||||
let mut db_options = db::ConnectOptions::new(config.database_url.clone());
|
||||
db_options.max_connections(config.database_max_connections);
|
||||
let mut db = Database::new(db_options, Executor::Production).await?;
|
||||
db.initialize_notification_kinds().await?;
|
||||
let db = Database::new(db_options, Executor::Production).await?;
|
||||
|
||||
let live_kit_client = if let Some(((server, key), secret)) = config
|
||||
.live_kit_server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue