roots / trellis-cli

A CLI to manage Trellis projects
https://roots.io/trellis/
MIT License
165 stars 25 forks source link

❤️ as a developer i need to generate a .vault_pass file when cloning a template repo using radicle/trellis so we can have better boilerplates #425

Closed chrillep closed 9 months ago

chrillep commented 9 months ago

Summary

when using radicle/trellis boilerplates. I need a way to generate a new .vault_pass via command. So exposing the already existing function as a subcommand seems fitting :)

https://github.com/roots/trellis-cli/blob/31008804a85cadf7f36bb900ecd1e4250e57548a/trellis/vault.go#L116-L125

trellis new vault-pass

Additional context

No response

codepuncher commented 9 months ago

suggest trellis vault pass new since trellis vault is an existing namespace also opens future possibility for trellis vault pass edit or others

chrillep commented 9 months ago

yeah the name ill let u guys decide. it was just an example :) the functionality however, is gold! :)

codepuncher commented 9 months ago

Yeah, I too would find this useful in project setup scripts; currently generating them myself.

chrillep commented 9 months ago

Yeah, I too would find this useful in project setup scripts; currently generating them myself.

yeah. exactly what im doing now, but it would be nicer if it was built in since the method already exists.

And also that would benefit everyone not just me scripting :)

swalkinshaw commented 9 months ago

Seems reasonable but just wondering why the file generate during trellis new isn't enough here? It is for existing projects?

swalkinshaw commented 9 months ago

I'm not against this yet, but it's pretty easy to script your own vault file too; especially if you're already writing scripts around other commands. Example:

LC_ALL=C tr -dc '[:alpha:]' </dev/urandom | head -c 64 > pass_file
codepuncher commented 9 months ago

Perhaps @chrillep is doing the same as me; I do not use trellis new because of having own project setup scripts. Not a big feature to have as we already generate vault pass ourselves but would be "nice" to use trellis to do this

chrillep commented 9 months ago

Seems reasonable but just wondering why the file generate during trellis new isn't enough here? It is for existing projects?

yes its for existing projects :) and for new projects based on templates.

I'm not against this yet, but it's pretty easy to script your own vault file too; especially if you're already writing scripts around other commands. Example:

LC_ALL=C tr -dc '[:alpha:]' </dev/urandom | head -c 64 > pass_file

we script it now. But the code is already there in trellis-cli, so why create another wheel? that was my thinking. Same goes for the salts.

i might have missed something in https://github.com/roots/radicle/blob/main/.radicle-setup/trellis.php

but i cant find trellis new there? =)

As always. Thanks for quality code and an open mind! ❤️

swalkinshaw commented 9 months ago

But the code is already there in trellis-cli, so why create another wheel? that was my thinking. Same goes for the salts.

The code is there but it's very simple and not really too Ansible/Trellis specific; it's just generating a random string into a file. It's important to handle it during trellis new because the expectation is you get a working project so it would be a bad user experience to not handle that in that context.

But for more power users with different use cases, it shouldn't be an expectation for trellis-cli to offer a command for everything. There's a downside in terms of command bloat and developer experience.

In terms of Radicle, maybe it could detect if trellis is installed and optionally use that. @retlehs can provide more context on how it's designed this way

swalkinshaw commented 9 months ago

Going to close this as it can easily be scripted. https://github.com/roots/radicle/issues/99 might remove the need entirely anyway