remove json key content
This commit is contained in:
parent
b243dbd93d
commit
958eb20559
|
@ -4,7 +4,6 @@ package gcs
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -135,7 +134,6 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||||
if tokenSource != nil {
|
if tokenSource != nil {
|
||||||
credOptions = append(credOptions, option.WithTokenSource(tokenSource))
|
credOptions = append(credOptions, option.WithTokenSource(tokenSource))
|
||||||
} else if creds != "" {
|
} else if creds != "" {
|
||||||
var account accountFile
|
|
||||||
|
|
||||||
// to mirror how the provider works, we accept the file path or the contents
|
// to mirror how the provider works, we accept the file path or the contents
|
||||||
contents, err := backend.ReadPathOrContents(creds)
|
contents, err := backend.ReadPathOrContents(creds)
|
||||||
|
@ -143,10 +141,6 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||||
return fmt.Errorf("Error loading credentials: %s", err)
|
return fmt.Errorf("Error loading credentials: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(contents), &account); err != nil {
|
|
||||||
return fmt.Errorf("Error parsing credentials '%s': %s", contents, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
credOptions = append(credOptions, option.WithCredentialsJSON([]byte(contents)))
|
credOptions = append(credOptions, option.WithCredentialsJSON([]byte(contents)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +209,3 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// accountFile represents the structure of the account file JSON file.
|
|
||||||
type accountFile struct {
|
|
||||||
PrivateKeyId string `json:"private_key_id"`
|
|
||||||
PrivateKey string `json:"private_key"`
|
|
||||||
ClientEmail string `json:"client_email"`
|
|
||||||
ClientId string `json:"client_id"`
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue