optiopay / klar

Integration of Clair and Docker Registry
MIT License
506 stars 140 forks source link

Add support to configure docker/clair timeouts #94

Closed ppacher closed 6 years ago

ppacher commented 6 years ago

This pull request adds support to configure clair (API v1) and docker timeouts using environment variables. Fixes #88

ppacher commented 6 years ago

Actually there is one more improvement that came to my mind. With the current implementation it is not possible to disable the timeout at all. Since klar.go#L50 always ensures returning 0 (without a possibility to check if the env var has actually been set). Therefore, setting CLAIR_TIMEOUT=0 doesn't do anything and causes a default timeout of 1 minute. I'd suggest changing parseIntOption to return an int as well as bool indicating if the value has been present at all.

Another possibility would be to support golangs duration format so it's easier to specify timeouts with seconds (e.g. 2m30s).

If your fine with those changes I can update the pull request.

hashmap commented 6 years ago

Thanks for contribution! Your suggestion sound reasonable, please go ahead if you like.