I working with Google cloud Stackdriver Trace API with C# (dotnet core) and working according to this article.
I already added all the needed code and want to try it locally (on my development machine). Since I'm not running from the GCP cloud, I created a new Service Account with the needed permissions. Google said in the article:
GCP client libraries use Application default credentials (ADC) to find your application's credentials. You provide these credentials by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable:
export GOOGLE_APPLICATION_CREDENTIALS=path-to-your-service-accounts-private-key
Now my code fails when reaching this point:
services.AddGoogleExceptionLogging(options =>
{
options.ProjectId = Configuration["Stackdriver:ProjectId"];
options.ServiceName = Configuration["Stackdriver:ServiceName"];
options.Version = Configuration["Stackdriver:Version"];
});
With the message:
System.InvalidOperationException: 'Error reading credential file from location C:******.json: Could not find file. Please check the value of the Environment Variable GOOGLE_APPLICATION_CREDENTIALS'
For many reasons, I don't want to use the environment variable called GOOGLE_APPLICATION_CREDENTIALS
. Instead, I'm looking for a way to provide it the actual file path, without using an environment variable.
How I can do it?