polite-sandwich-68547
04/26/2023, 8:22 AMcrtArn := config.Get(ctx, "certificate:arn")
if crtArn == "" {
return fmt.Errorf("certificate: config not found")
}
var vpcID = config.Get(ctx, "vpc:id")
if vpcID == "" {
return fmt.Errorf("vpc: config not found")
}
careful-bird-79707
04/26/2023, 10:54 AMconfig.Require
if you want to err when a key is missingpolite-sandwich-68547
04/26/2023, 2:17 PMvar crtArn = config.Require(ctx, "certificate:arn")
var vpcID = config.Require(ctx, "vpc:id")
careful-bird-79707
04/26/2023, 2:20 PMpolite-sandwich-68547
04/26/2023, 2:24 PMsalmon-account-74572
04/26/2023, 5:00 PMminClusterSize, err := cfg.TryInt("minClusterSize")
if err != nil {
minClusterSize = 3
}
This has the effect of setting a default value if the configuration value isn’t set. If you prefer to have the program error out, then Require
is the way to go IMO.polite-sandwich-68547
04/26/2023, 6:28 PMsalmon-account-74572
04/26/2023, 6:29 PM