cactus / go-camo

A secure image proxy server
MIT License
255 stars 48 forks source link

Allow server name configuration #25

Closed jacobbednarz closed 6 years ago

jacobbednarz commented 6 years ago

This introduces a couple of changes related to the server name.

The first is that it allows you to override the server name of go-camo using a start up flag of --server-name. The second is that it will now append the git sha of the latest build to the server name if it is defined and this has been great for us to perform some debugging/comparison between versions and be certain we are getting the correct outcomes.

Finally, this also updates the root route to return a 404 instead of a 200 with the server name. The thinking here is that as an image proxy, it should 404 unless it finds a resource to proxy (unless explicitly intended).

dropwhile commented 6 years ago

Almost there! Thanks for dealing with all the feedback. 👍

dropwhile commented 6 years ago

PR looks good. Can you rebase/squash into a single commit?

jacobbednarz commented 6 years ago

can do!

jacobbednarz commented 6 years ago

Should be ready for you now @cactus! Thanks for persisting this one through.

jacobbednarz commented 6 years ago

From https://github.com/golang/go/wiki/CompilerOptimizations#function-inlining

Only short and simple functions are inlined. To be inlined a function must contain less than ~40 expressions and does not contain complex things like function calls, loops, labels, closures, panic's, recover's, select's, switch'es, etc.

So I don't think the compiler would have inlined that one. Just personal taste I guess 🤷‍♂️

dropwhile commented 6 years ago

I manually merged this, along with a few tweaks. Let me know if the tweaks are acceptable (I simplified the server version / sha behavior a bit). Open a new issue for that I guess.

(github seems to be having a few issues today, so maybe that is why this PR wasn't automatically closed when I merged it via git directly?)

dropwhile commented 6 years ago

Also... Thanks again for the PR! 🎉

jacobbednarz commented 6 years ago

awesome, thanks! will you be cutting a release for these changes?

dropwhile commented 6 years ago

Yeah, I'll cut a release sometime tomorrow (most likely). I'll also likely bump the major version to reflect the slightly breaking changes in the api endpoints.

jacobbednarz commented 6 years ago

sounds good! ⭐️