tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
3.05k stars 475 forks source link

Add env vars to configuration the tusd service #1043

Open Maksclub opened 9 months ago

Maksclub commented 9 months ago

Is your feature request related to a problem? Please describe. I using golang-plugins for external behaviours and using internal abstractions of tusd (composer, store) then I would like configuring main tusd and my plugins via common var envs, but tusd use only flags.

Describe the solution you'd like I propose to use env tags. For example:

S3Bucket   string `envconfig:"S3_BUCKET"  required:"false"`
S3Endpoint string `envconfig:"S3_ENDPOINT"  required:"false"`
Basepath   string `envconfig:"BASE_PATH"  required:"false"`
HttpHost   string `envconfig:"HTTP_HOST"  required:"false"`
HttpPort   string `envconfig:"HTTP_PORT"  required:"false"`

Can you provide help with implementing this feature? Yes. I can add envconfig tags (or an alternative lib) and rename the config abstraction from "flags" to config for use flags and envs together

Acconut commented 9 months ago

I am open to adding this as it seems useful in certain situations. We should probably just discuss which library to use for this. A quick search also revealed https://github.com/jnovack/flag, which is advertised as a drop-in replacement for Go's flag package. Since we currently use flag, this would mean minimal changes to our code. Do you have other recommendations?

Maksclub commented 9 months ago

@Acconut thanks, https://github.com/jnovack/flag seems good compromise!

Acconut commented 9 months ago

Would you be interested in trying it out? :)