Skip to content

Commit 30d16e6

Browse files
committed
use configfromenv
1 parent a0d4d1f commit 30d16e6

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

config.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77

88
"github.com/akerl/go-lambda/s3"
9-
"github.com/ghodss/yaml"
109
)
1110

1211
type configFile struct {
@@ -23,19 +22,7 @@ type configFile struct {
2322

2423
func loadConfig() (*configFile, error) {
2524
c := configFile{}
26-
27-
bucket := os.Getenv("S3_BUCKET")
28-
path := os.Getenv("S3_KEY")
29-
if bucket == "" || path == "" {
30-
return &c, fmt.Errorf("config location not provided")
31-
}
32-
33-
obj, err := s3.GetObject(bucket, path)
34-
if err != nil {
35-
return &c, err
36-
}
37-
38-
err = yaml.Unmarshal(obj, &c)
25+
err := s3.GetConfigFromEnv(&c)
3926
if err != nil {
4027
return &c, err
4128
}

0 commit comments

Comments
 (0)