Configuration of docker containers: keeping larger .env files up-to-date

On some hosts we use git, docker-compose and .env files for deployment (.env files for configuration, obviously). We also supply a file named .env.example with our software containing a configuration sample with comments that help understand what the configuration options do.
Some of our systems have grown over the past and the .env files became hard to read + hard to sync from an example template. That’s why I came up with 2 helper scripts (on GitHub). Is there, besides these two custom written scripts any good solution for keeping container’s configuration in sync with a template/example configuration? How do you manage configuration of docker containers?