public async Task AddOrUpdateAppServerConfigAsync(ApplicationServerConfig config) { if (config == null || config.AppPath == null || config.Server == null) { throw new ArgumentException("AppPath and Server must be provided"); } var econfig = new ElasticApplicationConfig(); Map(config, econfig); await eclient.IndexAsync(econfig, ind => ind.Index(AppConfIndexName)); }
private void Map(ElasticApplicationConfig from, ApplicationServerConfig to) { to.AppPath = from.Path; to.Server = from.Server; to.ServerFqdnOrIp = from.ServerFqdnOrIp; to.ServiceName = from.ServiceName; to.AppPoolName = from.AppPoolName; to.AppType = from.AppType; to.Bindings = from.Binding != null?from.Binding.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) : null; to.DisplayName = from.DisplayName; }
private void Map(ApplicationServerConfig from, ElasticApplicationConfig to) { to.Id = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(from.AppPath + ":" + from.Server))).Replace("-", string.Empty); to.Path = from.AppPath; to.Server = from.Server; to.ServerFqdnOrIp = from.ServerFqdnOrIp; to.ServiceName = from.ServiceName; to.AppPoolName = from.AppPoolName; to.AppType = from.AppType; to.Binding = from.Bindings != null?string.Join("|", from.Bindings) : null; to.DisplayName = from.DisplayName; }