While some secrets have to be manually generated (e.g. by clicking through a graphical user interface), others can be programmatically generated.
That’s where the
generate command comes in.
When you want to generate a random password (or any random sequence of characters for that matter), you can use the
secrethub generate [options] <namespace>/<repo>[/<dir>]/<secret>
generate command generates a random string and writes it to the given path.
- The path to write the generated secret to.
- The length of the generated secret. Defaults to 22.
- Define the set of characters to randomly generate a password from. Options are
human-readable. Multiple character sets can be combined by supplying them in a comma separated list. Defaults to alphanumeric.
- String of the form
<charset>:<n>. Ensure that the resulting password contains at least n characters from the given character set. Note that adding constrains reduces the strength of the secret. When possible, avoid any constraints.
- Copy the generated value to the clipboard. The clipboard is automatically cleared after 45 seconds.