protected override Server ConfigureServer() { var env = _resolver.GetRequiredService <IHostingEnvironment>(); var host = Config["Hosts:Local:Host"]; var port = Config["Hosts:Local:Port"].ConvertTo <int>(); var serviceName = Config["Hosts:ServiceName"]; if (!env.IsDevelopment()) { port = Environment.GetEnvironmentVariable($"{serviceName.ToUpperInvariant()}_HOST").ConvertTo <int>(); } var server = new Server { Services = { InventoryService.BindService(new InventoryServiceImpl(_resolver)), Grpc.Health.V1.Health.BindService(new HealthImpl()) }, Ports = { new ServerPort(host, port, ServerCredentials.Insecure) } }; Logger.LogInformation($"{nameof(InventoryService)} is listening on {host}:{port}."); return(server); }