1
0
mirror of https://github.com/strongdm/comply synced 2024-11-23 16:14:54 +00:00

Allow github config to be passed in env (#62)

This commit is contained in:
Paddy Byers 2019-06-18 17:28:16 +01:00 committed by Justin McCarthy
parent e8d6d536a8
commit 87e8266f1b

View File

@ -3,7 +3,9 @@ package github
import (
"context"
"fmt"
"os"
"strconv"
"strings"
"sync"
"github.com/google/go-github/github"
@ -95,7 +97,10 @@ func (g *githubPlugin) Configure(cfg map[string]interface{}) error {
func getCfg(cfg map[string]interface{}, k string) (string, error) {
v, ok := cfg[k]
if !ok {
return "", errors.New("Missing key: " + k)
v = os.Getenv(fmt.Sprintf("GITHUB_%s", strings.ToUpper(k)))
if v == "" {
return "", errors.New("Missing key: " + k)
}
}
vS, ok := v.(string)