using System; using StackExchange.Redis; using System.Threading.Tasks; using RedisManager; using RedisManager.Utils; namespace RedisManager { public static class CustomConfigApplier { public static async Task ApplyCustomConfigAsync(InstanceConfig instance) { if (instance?.CustomConfig == null || instance.CustomConfig.Count == 0) return; try { var mux = RedisUtils.ConnectRedis(instance); var db = mux.GetDatabase(); foreach (var kv in instance.CustomConfig) { db.Execute("CONFIG", "SET", kv.Key, kv.Value); } mux.Dispose(); } catch (Exception ex) { Console.WriteLine($"[Daemon] Warning: Failed to apply custom config for instance '{instance.Name}': {ex.Message}"); } } } }