Skip to content

Commit fc597c0

Browse files
Added .env file loading for secrets
1 parent 3da1019 commit fc597c0

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

cmd/laclm/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/MakeNowJust/heredoc"
13+
"github.com/joho/godotenv"
1314
"github.com/spf13/cobra"
1415
"go.uber.org/zap"
1516

@@ -27,6 +28,11 @@ func main() {
2728
func exec() error {
2829

2930
/* exec() wraps run() protecting it with user interrupts */
31+
32+
err := godotenv.Load()
33+
if err != nil {
34+
fmt.Println("No .env file found, continuing with system environment variables")
35+
}
3036

3137
/* setting up cobra for cli interactions */
3238
var(

config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
app:
55
name: laclm-dev
66
version: v1.1
7-
debug_mode: false
7+
debug_mode: true
88

99
# backend server deployment configs
1010
server:
@@ -43,5 +43,5 @@ authentication:
4343
admin_password: ${LACLM_LDAP_ADMIN_PASSWORD}
4444

4545
backend_security:
46-
jwt_secret_key: ${JWT_SECRET_KEY}
46+
jwt_secret_token: ${JWT_SECRET_TOKEN}
4747
jwt_expiry: 1

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
1313
github.com/google/uuid v1.6.0 // indirect
1414
github.com/inconshreveable/mousetrap v1.1.0 // indirect
15+
github.com/joho/godotenv v1.5.1 // indirect
1516
github.com/spf13/cobra v1.9.1 // indirect
1617
github.com/spf13/pflag v1.0.6 // indirect
1718
go.uber.org/multierr v1.11.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1717
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1818
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
1919
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
20+
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
21+
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
2022
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
2123
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
2224
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=

0 commit comments

Comments
 (0)