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

Have S3 DOMAIN env setting so that Amazon URLs are not exposed #1128

Open
bmann opened this issue Jan 24, 2019 · 2 comments
Open

Have S3 DOMAIN env setting so that Amazon URLs are not exposed #1128

bmann opened this issue Jan 24, 2019 · 2 comments
Assignees

Comments

@bmann
Copy link

@bmann bmann commented Jan 24, 2019

I have Amazon S3 uploads setup in CodiMD and it all works great.

I have a bucket named images.example.com, and I even have DNS setup so that images.example.com is a CNAME for my Amazon bucket.

As far as I can tell, there is no S3_DOMAIN environment setting, so all the image URLs look like https://s3-ca-central-1.amazonaws.com/images.example.builders/uploads/upload_d0e2a4d44acf975c9b748ce7d47f5a94.png

(which is REGION/BUCKET)

The feature I am suggesting would introduce a new S3_DOMAIN env variable, where I could set images.example.com (ideally with / without https) and then the image URLs would be images.example.com/uploads/upload_d0e2a4d44acf975c9b748ce7d47f5a94.png.

If this feature DOES exist already, help in understanding how to set it would be appreciated :)

@SISheogorath
Copy link
Contributor

@SISheogorath SISheogorath commented Jan 24, 2019

It doesn't exist right now, but we might get that in the next version when you want to spend some time on it.

The main part to modify is here:

let s3Endpoint = 's3.amazonaws.com'
if (config.s3.region && config.s3.region !== 'us-east-1') {
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
}
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`)

And adding the option to the config library. PRs are welcome 👍

@bmann
Copy link
Author

@bmann bmann commented Jan 24, 2019

Great, thank you! I will put it on my backlog to work on :) Thanks for the very direct pointer to the code!

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.