check valid json
This commit is contained in:
parent
348c761bea
commit
81201d69a3
|
@ -4,6 +4,7 @@ package gcs
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -141,7 +142,7 @@ 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 !strings.HasPrefix(contents, "{") {
|
if !json.Valid([]byte(contents)) {
|
||||||
return fmt.Errorf("contents of credentials are invalid")
|
return fmt.Errorf("contents of credentials are invalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue