mirror of
https://github.com/strongdm/comply
synced 2024-11-05 15:35:25 +00:00
Allow github config to be passed in env (#62)
This commit is contained in:
parent
e8d6d536a8
commit
87e8266f1b
@ -3,7 +3,9 @@ package github
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-github/github"
|
"github.com/google/go-github/github"
|
||||||
@ -95,8 +97,11 @@ func (g *githubPlugin) Configure(cfg map[string]interface{}) error {
|
|||||||
func getCfg(cfg map[string]interface{}, k string) (string, error) {
|
func getCfg(cfg map[string]interface{}, k string) (string, error) {
|
||||||
v, ok := cfg[k]
|
v, ok := cfg[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
v = os.Getenv(fmt.Sprintf("GITHUB_%s", strings.ToUpper(k)))
|
||||||
|
if v == "" {
|
||||||
return "", errors.New("Missing key: " + k)
|
return "", errors.New("Missing key: " + k)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vS, ok := v.(string)
|
vS, ok := v.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user