mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement factory in main database, close #80
This commit is contained in:
@@ -14,6 +14,10 @@ pub struct CliArgs {
|
||||
/// Assets root
|
||||
#[arg(long, default_value_t = {"../assets/robocraft".to_string()})]
|
||||
pub assets: String,
|
||||
|
||||
/// User data root
|
||||
#[arg(long, default_value_t = {"../data/robocraft".to_string()})]
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
impl CliArgs {
|
||||
|
||||
@@ -25,7 +25,8 @@ async fn main() -> std::io::Result<()> {
|
||||
let cli_args = cli::CliArgs::get();
|
||||
|
||||
let conf = ConfigImpl::load(&cli_args.assets).map_err(io_error)?;
|
||||
let factory_enum = <ConfigImpl as ConfigProvider<()>>::factory(&conf).await.map_err(io_error)?;
|
||||
let users = oj_rc_core::persist::user::UserImpl::load(&cli_args.data, &conf).await.map_err(io_error)?;
|
||||
let factory_enum = <ConfigImpl as ConfigProvider<()>>::factory(&conf, &|| users.factory_impl()).await.map_err(io_error)?;
|
||||
let factory_data = actix_web::web::Data::new(factory_enum);
|
||||
|
||||
let mut handlebars_conf = handlebars::Handlebars::new();
|
||||
|
||||
Reference in New Issue
Block a user