/// <summary> /// Get the config service info from remote meta server. /// </summary> /// <returns> the services dto </returns> public IList <RemoteServiceConfig> GetConfigServices() { if (_configServices.ReadFullFence().Count == 0) { UpdateConfigServices(); } return(_configServices.ReadFullFence()); }
public string GetProperty(string key, string defaultValue) { if (_configProperties.ReadFullFence() != null) { return(_configProperties.ReadFullFence().GetProperty(key)); } _logger.LogError($"Could not load config for namespace {_namespaceName} from Apollo, please check whether the configs are released in Apollo! Return default value now!"); return(defaultValue); }
protected void Sync() { lock (this) { try { var previous = _config.ReadFullFence(); var current = LoadApolloConfig().GetAwaiter().GetResult(); if (!object.ReferenceEquals(_config.ReadFullFence(), current)) { _logger.LogInformation($"Remote Config refreshed!"); _config.WriteFullFence(current); this.FireRepositoryChange(_namespaceName, GetConfig()); } } catch (Exception ex) { throw ex; } } }