feat(auth): admin reset, docs and image smoke test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
42892cb37f
commit
06b9980659
18 files changed
+267
-21
No files matched your search
@@ -406,13 +406,24 @@ async fn shutdown_signal() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Path of an external secret key (a Docker secret), from `ACAUA_SECRET_KEY_FILE`.
|
||||
/// An unset or empty variable means the key lives in the data directory.
|
||||
pub(crate) fn secret_key_file(get: &dyn Fn(&str) -> Option<String>) -> Option<PathBuf> {
|
||||
get("ACAUA_SECRET_KEY_FILE")
|
||||
.filter(|value| !value.trim().is_empty())
|
||||
.map(PathBuf::from)
|
||||
}
|
||||
|
||||
pub async fn serve(bind: &str, data_dir: PathBuf) -> Result<()> {
|
||||
// Decide the exposure before touching the data directory or printing a
|
||||
// setup code: a refusal must leave nothing behind.
|
||||
let transport = Transport::from_env(&|name| std::env::var(name).ok())?;
|
||||
let _ = tracing_subscriber::fmt().try_init();
|
||||
std::fs::create_dir_all(&data_dir)?;
|
||||
let auth = Arc::new(AuthService::open(&data_dir, None)?);
|
||||
let auth = Arc::new(AuthService::open(
|
||||
&data_dir,
|
||||
secret_key_file(&|name| std::env::var(name).ok()).as_deref(),
|
||||
)?);
|
||||
if let Some(code) = auth.ensure_bootstrap(auth_http::unix_now())? {
|
||||
eprintln!("Acauã: código de configuração inicial (válido por 1 hora): {code}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user