Skip to content

Commit

Permalink
Merge pull request #52 from Venafi/zone-in-config
Browse files Browse the repository at this point in the history
make zone optional for revoke and renew
  • Loading branch information
mr-tron authored Nov 13, 2019
2 parents 9c96f7d + f26815b commit b586aa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cmd/vcert/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/Venafi/vcert/pkg/endpoint"
)

func buildConfig(cf *commandFlags) (cfg vcert.Config, err error) {
func buildConfig(co command, cf *commandFlags) (cfg vcert.Config, err error) {
cfg.LogVerbose = cf.verbose

if cf.config != "" {
Expand Down Expand Up @@ -96,9 +96,10 @@ func buildConfig(cf *commandFlags) (cfg vcert.Config, err error) {
}
cfg.Zone = cf.zone
}

if cfg.Zone == "" && cfg.ConnectorType != endpoint.ConnectorTypeFake && !(cf.pickupID != "" || cf.pickupIDFile != "") {
return cfg, fmt.Errorf("Zone cannot be empty. Use -z option")
if co == commandEnroll || co == commandPickup {
if cfg.Zone == "" && cfg.ConnectorType != endpoint.ConnectorTypeFake && !(cf.pickupID != "" || cf.pickupIDFile != "") {
return cfg, fmt.Errorf("Zone cannot be empty. Use -z option")
}
}

return cfg, nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/vcert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func main() {
return
}

cfg, err := buildConfig(cf)
cfg, err := buildConfig(co, cf)
if err != nil {
logger.Panicf("Failed to build vcert config: %s", err)
}
Expand Down

0 comments on commit b586aa2

Please sign in to comment.