Files
coa-server-manager/crates/coa-core/examples/ra_account.rs
T
ДмитрийandClaude Sonnet 5.5 e7b466a977 Install bootstrap uses free scratch ports (no collision with a running server); clean-base tool; install_pkg example
Verified: clean base built from the repack (0 accounts, 0 characters, 647 migrations), packaged, signed, installed
next to a running server, started with the CI-built worldserver to 'ready', first account created over RA.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 10:45:02 +05:00

13 lines
890 B
Rust

//! Create an account through the Manager's RA client on a RUNNING disposable fixture.
fn main() {
let a: Vec<String> = std::env::args().skip(1).collect();
assert!(a[0].to_lowercase().contains("fixture") || a[0].to_lowercase().contains("installtest") || a[0].to_lowercase().contains("cleaninstall"), "refusing: not a disposable folder");
let root = std::path::Path::new(&a[0]);
let mut ra = coa_core::ra::Ra::connect(root).expect("connect");
ra.create_account(&a[1], &a[2]).expect("create");
ra.make_administrator(&a[1]).expect("gm");
println!("created {} (administrator)", a[1]);
let out = coa_core::backup::with_database(root, |db| db.query(&format!("SELECT a.username, aa.gmlevel FROM acore_auth.account a LEFT JOIN acore_auth.account_access aa ON aa.id=a.id WHERE a.username='{}';", a[1].to_uppercase()))).unwrap();
println!("in database: {out}");
}