I created a small Java script that produces the user and password for Traefik in Docker Compose.
My little program is a good replacement for htpasswd.
I make the code available to the community so if anyone wants to improve it they can do it.
I hope it is useful.
public class TraefikPassword {
public static void main(String[] args) throws NoSuchAlgorithmException {
System.out.println("Password production for Traefik in Docker Compose by Federico Galimberti");
String userTraefik = "user";
String passwordTraefik = "password";
System.out.println(
"traefik.http.middlewares.auth.basicauth.users: " +
userTraefik +
":" +
Md5Crypt.md5Crypt(passwordTraefik.getBytes()).replace("$", "$$")
);
}
// Output
// traefik.http.middlewares.auth.basicauth.users: user:$$1$$ifRtujSw$$iFT0QyOjaz0waXQRsPgjj.
}
Good day