public RemoteConfigRepository(IOptions <ApolloConfig> apolloConfig, IOptions <ApolloSettings> apolloSettings, string namespaceName = "application") { InitScheduleRefresh(); _namespaceName = namespaceName; _apolloConfig = apolloConfig.Value; _apolloSettings = apolloSettings.Value; }
public RemoteConfigRepository(IOptions <ApolloSettings> apolloSettings, ILoggerFactory loggerFactory, ConfigServiceLocator configServiceLocator, string namespaceName = "application") { _logger = loggerFactory.CreateLogger <RemoteConfigRepository>(); _config = new ThreadSafe <ApolloConfig>(null); _remoteServiceConfig = new ThreadSafe <RemoteServiceConfig>(null); _serviceLocator = configServiceLocator; _namespaceName = namespaceName; _apolloSettings = apolloSettings.Value; InitScheduleRefresh(); }
public void IniGame(ApolloSettings settings, FightStyle fightStyle = FightStyle.Balanced) { //Logger.Debug("Set game beginning = true"); GameStateHandling.GameBeginning = true; Settings = settings; PlayerCharacterHandling.Reset(); EnemyCharacterPositionHandling.SetPositions(); Logger.Debug("IniGame"); //EnemyHandling.CreateEnemies(); }
private string BuildUrlFromSetting(ApolloSettings setting) { string uri = setting.Url; if (!uri.EndsWith("/", StringComparison.Ordinal)) { uri += "/"; } //Looks like .Net will handle all the url encoding for me... uri = $"{uri}configs/{setting.AppID}/{setting.Cluster}/{_namespaceName}"; var query = string.Empty;; if (!string.IsNullOrEmpty(localIp)) { query = $"{query}&ip={localIp}"; } return($"{uri}?{query}"); }
private string AssembleQueryConfigUrl(string url, ApolloSettings setting) { ///该接口会直接从数据库中获取配置,可以配合配置推送通知实现实时更新配置。 //var uri = $"{url.TrimEnd('/')}/configs/{setting.AppID}/{setting.Cluster}/{_namespaceName}"; //url内网地址 var uri = $"{url.TrimEnd('/')}/configs/{setting.AppID}/{setting.Cluster}/{_namespaceName}"; var query = string.Empty; if (!string.IsNullOrEmpty(NetworkUtil.LocalIp)) { query = $"{query}&ip={NetworkUtil.LocalIp}"; } var rKey = _config.ReadFullFence()?.ReleaseKey; if (!string.IsNullOrWhiteSpace(rKey)) { query = $"{query}&releaseKey={rKey}"; } return($"{uri}?{query.TrimStart('&')}"); }
public ConfigServiceLocator(IOptions <ApolloSettings> apolloSettings, ILoggerFactory loggerFactory) { _configServices = new ThreadSafe <IList <RemoteServiceConfig> >(new List <RemoteServiceConfig>()); _logger = loggerFactory.CreateLogger(typeof(ConfigServiceLocator)); _apolloSettings = apolloSettings.Value; }