This code has been almost fully generated by Chat GPT (conversation here).
Small docker container which allows getting the public IP of the container via HTTP request secured by a static password.
Just run the container and optionally specify flags:
-cacheDuration duration
duration of the cache response (default 20m0s)
-httpClientTimeout duration
timeout for the http client which calls the external API (default 10s)
-listenAddr string
address to listen (for example: :8080 or 0.0.0.0:80 (default ":8080")
-password string
password which will be required by Authorization header (default "password")
Get the container's public IP with:
curl -H "Authorization: <password>" http://localhost:8080