This commit is contained in:
Ruidy 2024-09-09 22:09:43 +02:00
parent 26c8996f0f
commit 3c31b142f6
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -114,7 +114,9 @@ func getTokenFromWeb(config *oauth2.Config) *oauth2.Token {
}
// Retrieves a token from a local file.
// #nosec G304
func tokenFromFile(file string) (*oauth2.Token, error) { //nolint:unused
f, err := os.Open(file)
if err != nil {
return nil, err
@ -134,6 +136,7 @@ func tokenFromEnv() (*oauth2.Token, error) {
}
// Saves a token to a file path.
// #nosec G304
func saveToken(path string, token *oauth2.Token) {
log.Printf("Saving credential file to: %s\n", path)
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)