Esempio n. 1
0
        private async Task LoadConfig()
        {
            try
            {
                var request = new GetConfigRequest
                {
                    DataId = _application
                };
                if (!string.IsNullOrWhiteSpace(_config.Group))
                {
                    request.Group = _config.Group;
                }
                if (!string.IsNullOrWhiteSpace(_config.Tenant))
                {
                    request.Tenant = _config.Tenant;
                }
                var config = await _client.GetConfigAsync(request);

                _listenerHelper.UpdateCache(request, config);
                Data.Clear();
                if (!string.IsNullOrWhiteSpace(config))
                {
                    LoadJson(config);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"加载配置[{_application}]异常:{ex.Message}");
            }
        }
Esempio n. 2
0
        public async Task GetTest()
        {
            var request = new GetConfigRequest
            {
                DataId = "redis"
            };
            var config = await _client.GetConfigAsync(request);

            Print(config);
        }