fix: load gcs credentials and client inside DriverConstructor (#4218)

This commit is contained in:
Wang Yan 2024-01-12 18:32:28 +08:00 committed by GitHub
commit 14366a2dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 33 deletions

View File

@ -34,6 +34,7 @@ func init() {
}
}
gcsDriverConstructor = func(rootDirectory string) (storagedriver.StorageDriver, error) {
jsonKey, err := os.ReadFile(credentials)
if err != nil {
panic(fmt.Sprintf("Error reading JSON key : %v", err))
@ -67,7 +68,6 @@ func init() {
panic(fmt.Sprintf("Error initializing gcs client : %v", err))
}
gcsDriverConstructor = func(rootDirectory string) (storagedriver.StorageDriver, error) {
parameters := driverParameters{
bucket: bucket,
rootDirectory: rootDirectory,