Backup #1364
| ID | 1364 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Infrastructure/Config/CredentialService.php |
| Version | 4 |
| Typ |
modified |
| Größe | 1.8 KB |
| Hash | 6ae25c4e780a47b8780f69e198f4c4ef87ca404271414953f1a22b60ad7e3479 |
| Datum | 2025-12-25 16:55:39 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
declare(strict_types=1);
namespace Infrastructure\Config;
// @responsibility: Zentrales Credential-Management aus Environment-Variablen
use RuntimeException;
final class CredentialService
{
/**
* Gets the MariaDB host.
*/
public static function getMariaDbHost(): string
{
return self::get('MARIADB_HOST', 'localhost');
}
/**
* Gets the MariaDB user.
*/
public static function getMariaDbUser(): string
{
return self::get('MARIADB_USER', 'root');
}
/**
* Gets the MariaDB root password.
*/
public static function getMariaDbPassword(): string
{
return self::getRequired('MARIADB_ROOT_PASSWORD');
}
/**
* Gets the Anthropic API key.
*/
public static function getAnthropicApiKey(): string
{
return self::getRequired('ANTHROPIC_API_KEY');
}
/**
* Gets the Ollama host URL.
*/
public static function getOllamaHost(): string
{
return self::get('OLLAMA_HOST', 'http://localhost:11434');
}
/**
* Gets the Qdrant host URL.
*/
public static function getQdrantHost(): string
{
return self::get('QDRANT_HOST', 'http://localhost:6333');
}
/**
* Gets an environment variable with a default value.
*/
public static function get(string $key, string $default = ''): string
{
return $_ENV[$key] ?? $_SERVER[$key] ?? getenv($key) ?: $default;
}
/**
* Gets a required environment variable.
*
* @throws RuntimeException If the variable is not set
*/
public static function getRequired(string $key): string
{
$value = self::get($key);
if ($value === '') {
throw new RuntimeException("Required environment variable not set: {$key}");
}
return $value;
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1364 |
4 |
modified |
1.8 KB |
2025-12-25 16:55 |
| 1360 |
3 |
modified |
1.5 KB |
2025-12-25 16:55 |
| 761 |
2 |
modified |
1.5 KB |
2025-12-23 08:02 |
| 124 |
1 |
modified |
2.8 KB |
2025-12-20 19:30 |
← Zurück zur Übersicht