stackdriver: wip - add logic for retrieving token from gce metadata server in the auth provider

This commit is contained in:
Erik Sundell
2018-10-22 16:03:13 +02:00
parent 77e4c4249d
commit 60617d0bf7
2 changed files with 14 additions and 13 deletions
+3 -2
View File
@@ -521,8 +521,9 @@ func replaceWithMetricPart(metaPartName string, metricType string) []byte {
func getProjectName(ctx context.Context, dsInfo *models.DataSource, route *plugins.AppPluginRoute) (string, error) {
var projectName string
gceAutoAuthentication := dsInfo.JsonData.Get("gceAutoAuthentication").MustBool()
if gceAutoAuthentication {
gceAutomaticAuthentication := dsInfo.JsonData.Get("gceAutomaticAuthentication").MustBool()
logger.Info("gceAutomaticAuthentication", "gceAutomaticAuthentication", gceAutomaticAuthentication)
if gceAutomaticAuthentication {
defaultCredentials, err := google.FindDefaultCredentials(ctx, route.JwtTokenAuth.Scopes...)
if err != nil {
return "", err