feat: API-Schlüssel für strata aus Umgebungsvariable

strata verlangt nach dem Start mit --access lan einen Schlüssel (HTTP 401).
Der Client liest ihn aus der Umgebungsvariable STRATA_API_KEY (Name in
config.toml änderbar) und sendet ihn als Bearer-Token. Der Schlüssel steht
weder in der Konfiguration noch im Repo.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 21:13:26 +01:00
parent f35b68ae1f
commit dce98d3d11
4 changed files with 17 additions and 7 deletions

View File

@ -27,6 +27,8 @@ pub struct Config {
pub ollama_url: String,
/// OpenAI-kompatibler Endpunkt, vollständige URL inkl. `/v1/chat/completions`.
pub openai_url: String,
/// Name der Umgebungsvariable mit dem API-Schlüssel. Der Schlüssel selbst steht nicht in der Datei.
pub openai_api_key_env: String,
/// Speicherlimit pro Lauf, Podman-Schreibweise.
pub sandbox_memory: String,
/// CPU-Anteil pro Lauf.
@ -43,6 +45,7 @@ impl Default for Config {
backend: "ollama".into(),
ollama_url: "http://127.0.0.1:11434".into(),
openai_url: "http://192.168.12.4:8082/v1/chat/completions".into(),
openai_api_key_env: "STRATA_API_KEY".into(),
sandbox_memory: limits.memory,
sandbox_cpus: limits.cpus,
}