Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit afcad3f

Browse files
committed
fixed .env var loading
1 parent b3a0337 commit afcad3f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ module github.com/passageidentity/example-go
22

33
go 1.15
44

5-
require github.com/passageidentity/passage-go v1.1.1
5+
require (
6+
github.com/joho/godotenv v1.4.0 // indirect
7+
github.com/passageidentity/passage-go v1.1.1
8+
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
44
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
5+
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
6+
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
57
github.com/passageidentity/passage-go v1.1.1 h1:nfc29QFPOhFrdcKr9pU5K4pVhsI+aWxtSxLSWjX4GPE=
68
github.com/passageidentity/passage-go v1.1.1/go.mod h1:UvFvzPuSKx16jwWXti/JIaW9+3MfJw2fE+PbMV43I5I=
79
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ import (
77
"os"
88
"text/template"
99

10+
"github.com/joho/godotenv"
1011
"github.com/passageidentity/passage-go"
1112
)
1213

1314
func main() {
15+
err := godotenv.Load(".env")
16+
if err != nil {
17+
log.Fatal("Failed to read .env variables")
18+
}
19+
1420
port := os.Getenv("PORT")
1521
if port == "" {
1622
log.Fatal("PORT environment variable required")

0 commit comments

Comments
 (0)