From fa86f5913cbcd89525d553a51447cf6a5c7a997f Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 19 Aug 2026 22:27:46 -0700 Subject: [PATCH] Replace the service-account key file with application-default credentials --- internal/blob/blob.go | 2 -- internal/data/sheet.go | 3 --- tools/createtabs/main.go | 2 -- tools/dumptab/main.go | 2 -- tools/findsheet/main.go | 2 -- tools/probeblob/main.go | 2 -- tools/sheets/main.go | 2 -- tools/writetab/main.go | 2 -- 8 files changed, 17 deletions(-) diff --git a/internal/blob/blob.go b/internal/blob/blob.go index 7be6c09..63eaa8c 100644 --- a/internal/blob/blob.go +++ b/internal/blob/blob.go @@ -24,7 +24,6 @@ import ( "google.golang.org/api/drive/v3" "google.golang.org/api/option" - "heliosian/internal/data" ) const ( @@ -54,7 +53,6 @@ type Store struct { func New() (*Store, error) { service, err := drive.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(drive.DriveScope)) if err != nil { return nil, err diff --git a/internal/data/sheet.go b/internal/data/sheet.go index 0186bb1..dc25032 100644 --- a/internal/data/sheet.go +++ b/internal/data/sheet.go @@ -9,8 +9,6 @@ import ( "google.golang.org/api/sheets/v4" ) -const KeyFile = "creds/service-account.json" - type Sheet struct { service *sheets.Service spreadsheets map[string]string @@ -18,7 +16,6 @@ type Sheet struct { func NewSheet(spreadsheets map[string]string) (*Sheet, error) { service, err := sheets.NewService(context.Background(), - option.WithCredentialsFile(KeyFile), option.WithScopes(sheets.SpreadsheetsScope)) if err != nil { return nil, err diff --git a/tools/createtabs/main.go b/tools/createtabs/main.go index 58db513..4844d8a 100644 --- a/tools/createtabs/main.go +++ b/tools/createtabs/main.go @@ -7,7 +7,6 @@ import ( "log" "strings" - "heliosian/internal/data" "google.golang.org/api/option" "google.golang.org/api/sheets/v4" ) @@ -45,7 +44,6 @@ func main() { log.Fatal("[ERROR] -sheet is required") } svc, err := sheets.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(sheets.SpreadsheetsScope)) if err != nil { log.Fatalf("[ERROR] create sheets client: %v", err) diff --git a/tools/dumptab/main.go b/tools/dumptab/main.go index c53f776..a14ec45 100644 --- a/tools/dumptab/main.go +++ b/tools/dumptab/main.go @@ -10,7 +10,6 @@ import ( "os" "strings" - "heliosian/internal/data" "google.golang.org/api/option" "google.golang.org/api/sheets/v4" ) @@ -24,7 +23,6 @@ func main() { log.Fatal("[ERROR] -sheet, -tab, and -out are required") } svc, err := sheets.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(sheets.SpreadsheetsReadonlyScope)) if err != nil { log.Fatalf("[ERROR] create sheets client: %v", err) diff --git a/tools/findsheet/main.go b/tools/findsheet/main.go index a653823..a640237 100644 --- a/tools/findsheet/main.go +++ b/tools/findsheet/main.go @@ -6,14 +6,12 @@ import ( "fmt" "log" - "heliosian/internal/data" "google.golang.org/api/drive/v3" "google.golang.org/api/option" ) func main() { svc, err := drive.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(drive.DriveReadonlyScope)) if err != nil { log.Fatalf("[ERROR] create drive client: %v", err) diff --git a/tools/probeblob/main.go b/tools/probeblob/main.go index 3f2480a..d6290b6 100644 --- a/tools/probeblob/main.go +++ b/tools/probeblob/main.go @@ -8,14 +8,12 @@ import ( "log" "time" - "heliosian/internal/data" "google.golang.org/api/drive/v3" "google.golang.org/api/option" ) func main() { svc, err := drive.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(drive.DriveScope)) if err != nil { log.Fatalf("[ERROR] drive client: %v", err) diff --git a/tools/sheets/main.go b/tools/sheets/main.go index ea2400b..b74795c 100644 --- a/tools/sheets/main.go +++ b/tools/sheets/main.go @@ -8,7 +8,6 @@ import ( "log" "strings" - "heliosian/internal/data" "google.golang.org/api/option" "google.golang.org/api/sheets/v4" ) @@ -25,7 +24,6 @@ func main() { log.Fatal("[ERROR] -sheet is required") } svc, err := sheets.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(sheets.SpreadsheetsReadonlyScope)) if err != nil { log.Fatalf("[ERROR] create sheets client: %v", err) diff --git a/tools/writetab/main.go b/tools/writetab/main.go index 3b26178..8021969 100644 --- a/tools/writetab/main.go +++ b/tools/writetab/main.go @@ -10,7 +10,6 @@ import ( "os" "strings" - "heliosian/internal/data" "google.golang.org/api/option" "google.golang.org/api/sheets/v4" ) @@ -39,7 +38,6 @@ func main() { log.Fatalf("[ERROR] %s has no data rows", *in) } svc, err := sheets.NewService(context.Background(), - option.WithCredentialsFile(data.KeyFile), option.WithScopes(sheets.SpreadsheetsScope)) if err != nil { log.Fatalf("[ERROR] create sheets client: %v", err)