public static void Main(string[] args) { var esUrl = Environment.GetEnvironmentVariable("ES_URL"); var esPassword = Environment.GetEnvironmentVariable("ES_PASS"); var esUser = Environment.GetEnvironmentVariable("ES_USER"); ElasticsearchBenchmarkExporterOptions options; if (!string.IsNullOrEmpty(esUrl) && !string.IsNullOrEmpty(esPassword) && !string.IsNullOrEmpty(esUser)) { Console.WriteLine($"Setting ElasticsearchBenchmarkExporterOptions based on environment variables - es URL: {esUrl}"); options = new ElasticsearchBenchmarkExporterOptions(esUrl) { Username = esUser, Password = esPassword }; } else { Console.WriteLine( "Setting ElasticsearchBenchmarkExporterOptions to export data to http://localhost:9200 - to change this set following environment variables: ES_URL, ES_PASS, ES_USER"); options = new ElasticsearchBenchmarkExporterOptions("http://localhost:9200"); } var exporter = new ElasticsearchBenchmarkExporter(options); var config = DefaultConfig.Instance.With(exporter); BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config); }
private static ElasticsearchBenchmarkExporter CreateElasticsearchExporter(string url, string username, string password) { if (string.IsNullOrWhiteSpace(url)) return null; var options = new ElasticsearchBenchmarkExporterOptions(url) { Username = username, Password = password, GitCommitSha = Commit, GitBranch = Branch, GitCommitMessage = CommitMessage, GitRepositoryIdentifier = Repository }; return new ElasticsearchBenchmarkExporter(options); }