private static void SetGoogleAuthentication(IGoogleCloudAccount googleCloudServiceAccountInfo) { var jsonCredentials = Newtonsoft.Json.JsonConvert.SerializeObject(googleCloudServiceAccountInfo); var credentialsFilePath = Path.Combine(Path.GetTempPath(), "google-application-credentials.json"); using (var streamWriter = File.CreateText(credentialsFilePath)) { streamWriter.Write(jsonCredentials); } Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", credentialsFilePath); }
/// <summary> /// Constructor /// </summary> /// <param name="next"></param> /// <param name="googleCloudAccount"></param> public HttpLoggingMiddleware(RequestDelegate next, IGoogleCloudAccount googleCloudAccount) { this.next = next; this.googleCloudAccount = googleCloudAccount; this.loggingClient = LoggingServiceV2Client.Create(); }