Files
kapow/internal/cmd/validations.go
pancho horrillo 23128026c7 Rework directory structure
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 12:05:53 +02:00

26 lines
417 B
Go

package cmd
import (
"errors"
"os"
"github.com/spf13/cobra"
)
func getEnv(key, fallback string) string {
value, exists := os.LookupEnv(key)
if !exists {
return fallback
}
return value
}
func handlerIDRequired(cmd *cobra.Command, args []string) error {
handler, _ := cmd.Flags().GetString("handler")
if handler == "" {
return errors.New("--handler or KAPOW_HANDLER_ID is mandatory")
}
return nil
}