Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GCP, Firebase, Azure file uploading support #17

Closed
abskrj opened this issue Dec 30, 2022 · 7 comments
Closed

Add GCP, Firebase, Azure file uploading support #17

abskrj opened this issue Dec 30, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@abskrj
Copy link
Member

abskrj commented Dec 30, 2022

We need a function which takes an enum (Azure, GCP, AWS, Firebase) param and generates a preSignedURL to for its cloud storage

@abskrj abskrj added the enhancement New feature or request label Dec 31, 2022
@scoobhidu
Copy link

picking this up @abhishekraj272

@scoobhidu
Copy link

scoobhidu commented Dec 31, 2022

image
which one of these three do you think would be best for generating signedURL in gcp?

@scoobhidu
Copy link

@uzaxirr @abhishekraj272 ?

@uzaxirr
Copy link
Member

uzaxirr commented Jan 1, 2023

image which one of these three do you think would be best for generating signedURL in gcp?

The first one where we use the private key which is obtained from the console

@uzaxirr
Copy link
Member

uzaxirr commented Jan 1, 2023

The Private Key and Acess ID would be stored in environment variables. The snippet below is an example.

// Set the bucket and object names.
bucketName := "my-bucket"
objectName := "my-object"

// Set the signed URL expiration time to one hour from now.
expirationTime := time.Now().Add(time.Hour).Unix()

// Get the private key and access ID from environment variables.
privateKey := os.Getenv("PRIVATE_KEY")
accessID := os.Getenv("ACCESS_ID")

// Set the signed URL options.
opt := &storage.SignedURLOptions{
	GoogleAccessID: accessID,
	PrivateKey:     []byte(privateKey),
	Method:         "GET",
	Expires:        expirationTime,
	ContentType:    "application/octet-stream",
}

// Create the signed URL.
signedURL, err := storage.SignedURL(bucketName, objectName, opt)
if err != nil {
	// Handle error.
	return
}

@uzaxirr
Copy link
Member

uzaxirr commented Jan 1, 2023

@loyaltytrooper do let me know if you are ready to take this up, i'll assign this to you

@abskrj
Copy link
Member Author

abskrj commented Oct 8, 2023

Done

@abskrj abskrj closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants