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

feat: adicionado suporte ao r2 #1151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HugoSilvaF
Copy link

@HugoSilvaF HugoSilvaF commented May 14, 2024

Pull Request Description

I changed config.json, ResourceConfig interface, http-service.
I have added supports to Cloudflare R2 to upload images.
IMGUR doesnt works anymore, so i have added another option.

To r2 works, need the public link in

image
In url needs the public url the r2

"images": {
    "url": "https://pub-your-public-url.r2.dev/",
    "type": "r2",
    "imageEncoding": "jpg",
    "contentType": "multipart/form-data",
    "useContentType": true,
    "authorizationHeader": "Authorization",
    "authorizationPrefix": "Client-ID",
    "useAuthorization": true,
    "returnedDataIndexes": ["data", "link"],
    "r2": {
      "bucketName": "your-bucktname",
      "endpoint" : "https://your-endpoint.r2.cloudflarestorage.com",
      "credentials": {
        "accessKeyId": "your-access-key-id",
        "secretAccessKey": "your-secret-access-key"
      }
    }
  },

your config

image

you need access cloudflare and create an account and a public r2 bucket

https://dash.cloudflare.com/

after created your account you need go to the r2 overiew

image

after this, you need create an bucket

image

after created your bucket go to the settings and get a public url

image

getting a public url

image

Pull Request Checklist:

  • Have you followed the guidelines in our Contributing document and Code of Conduct?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you built and tested NPWD in-game after the relevant change?

@HugoSilvaF HugoSilvaF closed this May 14, 2024
@HugoSilvaF HugoSilvaF deleted the r2 branch May 14, 2024 03:46
@HugoSilvaF HugoSilvaF restored the r2 branch May 14, 2024 03:46
@HugoSilvaF HugoSilvaF reopened this May 17, 2024
@HugoSilvaF
Copy link
Author

HugoSilvaF commented May 17, 2024

I am waiting the approval.

@itschip
Copy link
Member

itschip commented May 20, 2024

Hey @HugoSilvaF ! Awesome PR! I'll have a look!

Would be great if you could also update the docs with this guide!

Comment on lines +32 to +33
accessKeyId: config.images.r2.credentials.accessKeyId,
secretAccessKey: config.images.r2.credentials.secretAccessKey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should not be in the config. We should get these from Convars not exposed to client.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment on lines +48 to 52
"dependencies": {
"@aws-sdk/client-s3": "^3.574.0",
"aws-sdk": "^2.1618.0"
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please install these the correct package.json file. We are using turborepo, so you can install these deps in the game package like this

pnpm --filter @npwd/game add .... from the root dir.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants