Skip to content

Commit

Permalink
issue cmd: more yaml help text
Browse files Browse the repository at this point in the history
  • Loading branch information
yzp0n committed May 22, 2020
1 parent 62d8693 commit d8620fc
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions cmd/kmgm/issue/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,14 @@ func PromptCertPath(env *action.Environment, privPath, certPath string) (string,
return certPath, nil
}

// FIXME[P2]: Help msg for keyType
// FIXME[P2]: Should escape
const ConfigTemplateText = `
---
# kmgm pki new cert config
privateKeyPath: {{ .PrivateKeyPath }}
certPath: {{ .CertPath }}
{{- with .Issue }}
issue:
{{ template "subject" .Subject }}
{{ template "subject" .Subject }}
# The subjectAltNames specifies hostnames or ipaddrs which the cert is issued
# against.
Expand All @@ -207,7 +203,11 @@ issue:
# validity: 2y # valid for 2 years from now.
# validity: 20220530 # valid until yyyyMMdd.
# The type of private/public key pair.
keyType: {{ .KeyType }}
# keyType: any # Accept any key type, or create RSA key pair if not exists.
# keyType: rsa
# keyType: ecdsa
# keyUsage specifies the purpose of the key signed.
keyUsage:
Expand Down Expand Up @@ -237,9 +237,22 @@ issue:
- clientAuth
{{ CommentOutIfFalse (and (eq .KeyUsage.Preset "custom") (HasExtKeyUsage "serverAuth" .KeyUsage.ExtKeyUsages)) -}}
- serverAuth
{{ end -}}
{{ end }}
# Private key file path:
# If the file exists, kmgm reads it.
# If the file does not exist, kmgm generates a new one.
privateKeyPath: {{ .PrivateKeyPath }}
# Certificate file path:
# If the file exists, kmgm renews the certificate.
# If the file does not exist, kmgm issues a fresh one.
certPath: {{ .CertPath }}
# Renew certificate only if it expires within the specified threshold.
renewBefore: {{ .RenewBefore }}
# renewBefore: immediately # renew regardless of the expiration date.
# renewBefore: 7d # renew only if the certificate is set to expire within 7 days.
`

type Config struct {
Expand Down

0 comments on commit d8620fc

Please sign in to comment.