Use a more distint map key to indicate template version

- make the key a variable that can be reused on the CLI side.
This commit is contained in:
max furman 2021-11-13 14:22:23 -08:00
parent f426c152a9
commit 507be61e8c
2 changed files with 5 additions and 1 deletions

View file

@ -103,7 +103,7 @@ func (a *Authority) GetSSHConfig(ctx context.Context, typ string, data map[strin
}
// Backwards compatibility for version of the cli older than v0.18.0
if o.Name == "step_includes.tpl" && (data == nil || data["Version"] != "v2") {
if o.Name == "step_includes.tpl" && (data == nil || data[templates.SSHTemplateVersionKey] != "v2") {
o.Type = templates.File
o.Path = strings.TrimPrefix(o.Path, "${STEPPATH}/")
}

View file

@ -4,6 +4,10 @@ import (
"golang.org/x/crypto/ssh"
)
// SSHTemplateVersionKey is a key that can be submitted by a client to select
// the template version that will be returned by the server.
var SSHTemplateVersionKey = "StepSSHTemplateVersion"
// Step represents the default variables available in the CA.
type Step struct {
SSH StepSSH