Skip to content

Commit 7639f19

Browse files
authored
Merge pull request #1335 from cpanato/remove-flag-ann
krel/announce: remove --sendgrid-api-key flag in favor to env var only
2 parents b5184f8 + faff95f commit 7639f19

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

cmd/krel/cmd/announce.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
)
3131

3232
const (
33-
sendgridAPIKeyFlag = "sendgrid-api-key"
3433
sendgridAPIKeyEnvKey = "SENDGRID_API_KEY"
3534
nameFlag = "name"
3635
emailFlag = "email"
@@ -50,8 +49,7 @@ krel announce can be used to announce already built Kubernetes releases to the
5049
If --nomock=true (the default), then the mail will be sent only to a test
5150
Google Group %q.
5251
53-
It is necessary to either set a valid --%s,-s or export the
54-
$%s environment variable. An API key can be created by
52+
It is necessary to export the $%s environment variable. An API key can be created by
5553
registering a sendgrid.com account and adding the key here:
5654
5755
https://app.sendgrid.com/settings/api_keys
@@ -67,7 +65,6 @@ without doing anything else.`,
6765
mail.KubernetesAnnounceGoogleGroup,
6866
mail.KubernetesDevGoogleGroup,
6967
mail.KubernetesAnnounceTestGoogleGroup,
70-
sendgridAPIKeyFlag,
7168
sendgridAPIKeyEnvKey,
7269
nameFlag,
7370
emailFlag,
@@ -92,16 +89,7 @@ type announceOptions struct {
9289
var announceOpts = &announceOptions{}
9390

9491
func init() {
95-
announceCmd.PersistentFlags().StringVarP(
96-
&announceOpts.sendgridAPIKey,
97-
sendgridAPIKeyFlag,
98-
"s",
99-
util.EnvDefault(sendgridAPIKeyEnvKey, ""),
100-
fmt.Sprintf(
101-
"API key for sendgrid, can be set via %s too",
102-
sendgridAPIKeyEnvKey,
103-
),
104-
)
92+
announceOpts.sendgridAPIKey = util.EnvDefault(sendgridAPIKeyEnvKey, "")
10593

10694
announceCmd.PersistentFlags().StringVarP(
10795
&announceOpts.name,
@@ -167,7 +155,7 @@ func runAnnounce(opts *announceOptions, rootOpts *rootOptions) error {
167155

168156
if opts.sendgridAPIKey == "" {
169157
return errors.Errorf(
170-
"Neither --sendgrid-api-key,-s nor $%s is set", sendgridAPIKeyEnvKey,
158+
"$%s is not set", sendgridAPIKeyEnvKey,
171159
)
172160
}
173161

0 commit comments

Comments
 (0)