rewrite getCredentials to be more generic

This commit is contained in:
2023-08-29 21:55:30 -04:00
parent a0081fab99
commit 14d2165daf
2 changed files with 26 additions and 17 deletions

View File

@@ -14,9 +14,9 @@ const (
BUCKETNAME = "ducimon-db-backups"
)
func UploadFile(ctx context.Context, accessKeyID, secretAccessKey) error {
func UploadFile(ctx context.Context, b2Creds map[string]string) error {
client := createClient(accessKeyID, secretAccessKey)
client := createClient(b2Creds["B2_KEY_ID"], b2Creds["B2_APPLICATION_KEY"])
verifyBucket(client, ctx)
absolutePath, basename := validateUploadFile()
_, err := client.FPutObject(ctx, BUCKETNAME, "test", absolutePath, minio.PutObjectOptions{})