Centralize BaseUrl logic via AcEnv; enforce fail-fast
Refactored BaseUrl handling so FruitBankConstClient delegates all access to AcEnv.BaseUrl in AyCode.Core, ensuring a single source of truth and fail-fast validation. Removed redundant _baseUrl field and logic from FruitBankConstClient. Updated startup files to hydrate BaseUrl from configuration and improved comments to clarify the new delegation and configuration conventions.
This commit is contained in:
parent
3a9a8fa540
commit
d5503ca13e
|
|
@ -22,6 +22,18 @@ namespace AyCode.Core.Consts
|
|||
|
||||
public static ulong MaxLogItemsPerSession = 250;
|
||||
|
||||
/// <summary>
|
||||
/// A szerver base URL-je (pl. "https://localhost:59579") — a kliens-hostok hidratálják induláskor
|
||||
/// a configból (konvenció: "AyCode:Urls:BaseUrl"). A hub-/link-URL-ek EBBŐL az egy értékből származnak.
|
||||
/// Fail-fast: hidratálatlan olvasás exception — hiányzó/rossz URL-lel nem megyünk tovább csendben.
|
||||
/// </summary>
|
||||
private static string? _baseUrl;
|
||||
public static string BaseUrl
|
||||
{
|
||||
get => !string.IsNullOrWhiteSpace(_baseUrl) ? _baseUrl : throw new InvalidOperationException("AcEnv.BaseUrl nincs beállítva — a host indulásakor hidratáld a configból (konvenció: 'AyCode:Urls:BaseUrl').");
|
||||
set => _baseUrl = value;
|
||||
}
|
||||
|
||||
private static IConfiguration? _appConfiguration = null;
|
||||
public static IConfiguration AppConfiguration => _appConfiguration ??= GetAppSettingsConfiguration();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue