protected async Task <string> GetServerUrlAsync(string paramList, int index, string defaultUrl) { var urlParam = GetParam(paramList, index++); var url = defaultUrl; IInfluxDbAgent client = null; if (!string.IsNullOrEmpty(url) && url != Constants.NoConfigUrl) { try { client = _influxDbAgentLoader.GetAgent(new InfluxDatabaseConfig(url, "root", "qwerty", "qwerty")); } catch (Exception exception) { OutputWarning(exception.Message); } } var connectionConfirmed = false; try { if (client != null) { connectionConfirmed = await client.CanConnect(); } } catch (Exception exception) { OutputError("{0}", exception.Message); } if (!connectionConfirmed) { OutputInformation("Enter the url to the InfluxDB to use."); OutputInformation("Provide the correct port, typically 8086. (Ex. http://tharga.net:8086)"); while (!connectionConfirmed) { try { url = QueryParam <string>("Url", urlParam); urlParam = null; client = _influxDbAgentLoader.GetAgent(new InfluxDatabaseConfig(url, "root", "qwerty", "qwert")); connectionConfirmed = await client.CanConnect(); } catch (CommandEscapeException) { return(null); } catch (Exception exception) { OutputError("{0}", exception.Message.Split('\n')[0]); } } _configBusiness.SaveDatabaseUrl(url); } OutputInformation("Connection to server {0} confirmed.", url); return(url); }