jwilder / dockerize

Utility to simplify running applications in docker containers
MIT License
4.95k stars 414 forks source link

Add random hash generator to templating engine #117

Open moenka opened 6 years ago

moenka commented 6 years ago

Please add a random hash generator for the templating engine since sometimes it's necessary to create hashes for configurations (e.g. Wordpress secret keys). The function name is randomHash.

The generator should take the arguments:

As a bonus the function must also work with the default function.

Example: {{ randomHash "32" "[a-zA-Z0-9\[\]\{\}\.]" }} {{ default .Env.AUTH_KEY randomHash "40" }}

powerman commented 5 years ago

Fork https://github.com/powerman/dockerize provides a lot of new functions, e.g. you can try to use uuidv4 or one of cryptographic functions. If these won't fit your needs please consider opening issue or PR in fork's repo.