using System; using System.Configuration; using System.IO; using System.Xml; namespace BeWo.ServiceUtils.Core { public static class MergedConfig { public static string GetSetting(string key) { // 1. Versuche, aus AppSettings.local.config zu lesen var localConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web.Secrets.config"); if (File.Exists(localConfigPath)) { var xml = new XmlDocument(); xml.Load(localConfigPath); var node = xml.SelectSingleNode($"/appSettings/add[@key='{key}']"); if (node is XmlElement element) return element.GetAttribute("value"); } // 2. Fallback: Standard-AppSettings return ConfigurationManager.AppSettings[key]; } } }