Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined templates #3

Open
nickthecook opened this issue May 30, 2020 · 1 comment
Open

User-defined templates #3

nickthecook opened this issue May 30, 2020 · 1 comment

Comments

@nickthecook
Copy link
Owner

ops has some built-in templates (e.g. ruby, terraform). If a user wants a different template, they have to either:

  1. store a file somewhere and copy it into a repo when initializing a new app
  2. send a PR to this project to add their template (which may not have universal utility)

ops should look for templates first in ~/.ops/templates, then fall back to built-in templates.

The ~/.ops directory can be used in the future for global (rather than project-specific) config.

@nickthecook
Copy link
Owner Author

As an intermediate step, or as the whole feature, allow the user to pass a template on the command line. So, if the user runs

$ ops init my_template.yml

ops should look in the usual place for a template called my_template.yml. If it's not found, look for a file called my_template.yml.

Users could even put their templates in a directory that is easy to reference globally:

$ ops init ~/.ops/my_template.yml

Not quite as nice as having a ~/.ops/tempaltes/my_template and just running ops init my_template, though, so ops should probably still support the original idea as well. In that case, ops should look in:

  • the user template dir, then
  • the ops template dir, then
  • try to find a file with the given name

The reason to look in template directories before looking for a file is that if there is a file or directory in the current directory called ruby or terraform, ops would try to load it as a template. This would make any file or directory name that was also the name of an ops template a bit of a landmine for the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant