Skip to content

Commit 8ef062e

Browse files
authored
use string gcp credentials (#286)
1 parent 4c9239b commit 8ef062e

File tree

8 files changed

+11
-13
lines changed

8 files changed

+11
-13
lines changed

cmd/server/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"embed"
55
"fmt"
66
"io/fs"
7-
"io/ioutil"
87
"net/http"
98
"os"
109
"os/signal"
@@ -82,7 +81,7 @@ func runService(c *cli.Context) error {
8281
if configFile == "" {
8382
return errors.ErrNoConfig
8483
}
85-
content, err := ioutil.ReadFile(configFile)
84+
content, err := os.ReadFile(configFile)
8685
if err != nil {
8786
return err
8887
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/livekit/livekit-server v1.3.5-0.20230218061519-7a2d9b3d615e
2222
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
2323
github.com/livekit/mediatransportutil v0.0.0-20230130133657-96cfb115473a
24-
github.com/livekit/protocol v1.4.3-0.20230228235227-721dbba55d18
24+
github.com/livekit/protocol v1.4.3
2525
github.com/livekit/psrpc v0.2.9
2626
github.com/livekit/server-sdk-go v1.0.7-0.20230112195259-5bc292cbbdf2
2727
github.com/pion/rtcp v1.2.10

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
264264
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
265265
github.com/livekit/mediatransportutil v0.0.0-20230130133657-96cfb115473a h1:5UkGQpskXp7HcBmyrCwWtO7ygDWbqtjN09Yva4l/nyE=
266266
github.com/livekit/mediatransportutil v0.0.0-20230130133657-96cfb115473a/go.mod h1:1Dlx20JPoIKGP45eo+yuj0HjeE25zmyeX/EWHiPCjFw=
267-
github.com/livekit/protocol v1.4.3-0.20230228235227-721dbba55d18 h1:9HU+GLf3KHCCuod5VrNvdWlkRMjlXFZobL6JR8PwhzA=
268-
github.com/livekit/protocol v1.4.3-0.20230228235227-721dbba55d18/go.mod h1:hkK/G0wwFiLUGp9F5kxeQxq2CQuIzkmfBwKhTsc71us=
267+
github.com/livekit/protocol v1.4.3 h1:z+xiG5NmBnfnuDQHZ4LesqT+yZuLyKBQPZaaBUKPx+E=
268+
github.com/livekit/protocol v1.4.3/go.mod h1:hkK/G0wwFiLUGp9F5kxeQxq2CQuIzkmfBwKhTsc71us=
269269
github.com/livekit/psrpc v0.2.9 h1:F9QatmORMcCzzzkDDqFJHe1ZIrJw9rXiluBk33Pmcdw=
270270
github.com/livekit/psrpc v0.2.9/go.mod h1:K0j8f1PgLShR7Lx80KbmwFkDH2BvOnycXGV0OSRURKc=
271271
github.com/livekit/rtcscore-go v0.0.0-20220815072451-20ee10ae1995 h1:vOaY2qvfLihDyeZtnGGN1Law9wRrw8BMGCr1TygTvMw=

pkg/config/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type GCPConfig struct {
8282

8383
func (c *GCPConfig) ToGCPUpload() *livekit.GCPUpload {
8484
return &livekit.GCPUpload{
85-
Credentials: []byte(c.CredentialsJSON),
85+
Credentials: c.CredentialsJSON,
8686
Bucket: c.Bucket,
8787
}
8888
}

pkg/config/output.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ func redactUpload(upload uploader) {
542542
}
543543

544544
if gcp := upload.GetGcp(); gcp != nil {
545-
gcp.Credentials = []byte(util.Redact(string(gcp.Credentials)))
545+
gcp.Credentials = util.Redact(gcp.Credentials)
546546
return
547547
}
548548

pkg/pipeline/sink/uploader/gcp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func (u *GCPUploader) Upload(localFilepath, storageFilepath string, _ types.Outp
4343
}
4444

4545
var client *storage.Client
46-
if u.conf.Credentials != nil {
47-
client, err = storage.NewClient(ctx, option.WithCredentialsJSON(u.conf.Credentials))
46+
if u.conf.Credentials != "" {
47+
client, err = storage.NewClient(ctx, option.WithCredentialsJSON([]byte(u.conf.Credentials)))
4848
} else {
4949
client, err = storage.NewClient(ctx)
5050
}

test/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package test
44

55
import (
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"testing"
109

@@ -65,7 +64,7 @@ func NewTestContext(t *testing.T) *TestConfig {
6564
if confString == "" {
6665
confFile := os.Getenv("EGRESS_CONFIG_FILE")
6766
require.NotEmpty(t, confFile)
68-
b, err := ioutil.ReadFile(confFile)
67+
b, err := os.ReadFile(confFile)
6968
require.NoError(t, err)
7069
confString = string(b)
7170
}

test/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ func downloadGCP(t *testing.T, conf *livekit.GCPUpload, localFilepath, storageFi
194194
var client *storage.Client
195195

196196
var err error
197-
if conf.Credentials != nil {
198-
client, err = storage.NewClient(ctx, option.WithCredentialsJSON(conf.Credentials))
197+
if conf.Credentials != "" {
198+
client, err = storage.NewClient(ctx, option.WithCredentialsJSON([]byte(conf.Credentials)))
199199
} else {
200200
client, err = storage.NewClient(ctx)
201201
}

0 commit comments

Comments
 (0)