Code imported from @CesarGallego private repo

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-10-02 15:49:16 +02:00
parent e146ec6647
commit 3602dc71f2
10 changed files with 328 additions and 22 deletions
+25
View File
@@ -0,0 +1,25 @@
package command
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
}