keep the operator matrix admin grant record in nats kv, not on disk
This commit is contained in:
parent
c24f3c3d88
commit
28d847cb7e
1 changed files with 312 additions and 87 deletions
|
|
@ -19,9 +19,10 @@ use utoipa::OpenApi;
|
|||
use utoipa_axum::{router::OpenApiRouter, routes};
|
||||
|
||||
use crate::jobq::{
|
||||
Late, SwarmNodeKind, SwarmResourceKind, queue_agent_renewals, queue_builder_forge_token_mint,
|
||||
queue_ci_metrics_forge_token_mint, queue_classifier_forge_token_mint, queue_docs_grants,
|
||||
queue_forge_token_mints, queue_hive_forge_token_mints, queue_matrix_account_mints,
|
||||
Late, SwarmNodeKind, SwarmResourceKind, WorkerDeps, queue_agent_renewals,
|
||||
queue_builder_forge_token_mint, queue_ci_metrics_forge_token_mint,
|
||||
queue_classifier_forge_token_mint, queue_docs_grants, queue_forge_token_mints,
|
||||
queue_hive_forge_token_mints, queue_matrix_account_mints,
|
||||
};
|
||||
use crate::routes::hives::{HiveEntry, ServiceLink};
|
||||
use crate::routes::{self, AppState, agents, config_prs, forge_admin, hives, jobq_graph};
|
||||
|
|
@ -262,19 +263,25 @@ pub(crate) fn configured_matrix_homeserver() -> Option<Arc<str>> {
|
|||
|
||||
/// Start the recovery passphrase pass, which needs only the store; the
|
||||
/// matrix-account backfill when a homeserver is configured; and the operator
|
||||
/// admin pass when the bridge is too. Lifted out of `main` for
|
||||
/// admin pass when the bridge and the swarm queue are too. Lifted out of `main` for
|
||||
/// `clippy::too_many_lines`.
|
||||
pub(crate) fn spawn_matrix_account_backfill(
|
||||
jobq: &Arc<Mutex<hive_jobq::scheduler::Scheduler<SwarmNodeKind, SwarmResourceKind>>>,
|
||||
homeserver: Option<Arc<str>>,
|
||||
auth: Option<Arc<auth::AuthBridge>>,
|
||||
deps: &WorkerDeps,
|
||||
) {
|
||||
matrix_account::recovery::spawn();
|
||||
let Some(base) = homeserver else {
|
||||
let Some(base) = deps.matrix_homeserver.clone() else {
|
||||
return;
|
||||
};
|
||||
if let Some(bridge) = auth {
|
||||
matrix_account::operator_admin::spawn(bridge, Arc::clone(&base));
|
||||
match (deps.auth.clone(), deps.queue.clone()) {
|
||||
(Some(bridge), Some(queue)) => {
|
||||
matrix_account::operator_admin::spawn(bridge, Arc::clone(&base), queue);
|
||||
}
|
||||
(Some(_), None) => tracing::warn!(
|
||||
"operator matrix admin: no swarm queue is configured, so the granted set has \
|
||||
nowhere to live; the sync is not started"
|
||||
),
|
||||
(None, _) => {}
|
||||
}
|
||||
let sched = Arc::clone(jobq);
|
||||
matrix_account::agent_token::spawn(base, move |agents| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue