Skip to content

Commit 1a7aaea

Browse files
oktalzmjuraga
authored andcommitted
MINOR: env: add option to load environment variables from .env file
1 parent dab0faa commit 1a7aaea

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

cmd/dataplaneapi/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ import (
2323
"path/filepath"
2424
"syscall"
2525

26+
_ "github.com/KimMachineGun/automemlimit"
2627
loads "github.com/go-openapi/loads"
2728
"github.com/go-openapi/runtime"
2829
"github.com/go-openapi/runtime/security"
29-
flags "github.com/jessevdk/go-flags"
30-
31-
_ "github.com/KimMachineGun/automemlimit"
3230
"github.com/haproxytech/client-native/v6/models"
3331
"github.com/haproxytech/client-native/v6/storage"
3432
"github.com/haproxytech/dataplaneapi"
3533
"github.com/haproxytech/dataplaneapi/configuration"
3634
"github.com/haproxytech/dataplaneapi/log"
3735
"github.com/haproxytech/dataplaneapi/operations"
3836
socket_runtime "github.com/haproxytech/dataplaneapi/runtime"
37+
flags "github.com/jessevdk/go-flags"
38+
"github.com/joho/godotenv"
3939
_ "go.uber.org/automaxprocs"
4040
)
4141

@@ -59,6 +59,7 @@ var cliOptions struct {
5959
}
6060

6161
func main() {
62+
_ = godotenv.Load()
6263
cancelDebugServer := startRuntimeDebugServer()
6364

6465
cfg := configuration.Get()

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ require (
2626
github.com/google/uuid v1.6.0
2727
github.com/haproxytech/client-native/v6 v6.0.0-20240806205348-3c6c7501d445
2828
github.com/jessevdk/go-flags v1.5.0
29+
github.com/joho/godotenv v1.5.1
2930
github.com/json-iterator/go v1.1.12
3031
github.com/kr/pretty v0.3.1
3132
github.com/lestrrat-go/apache-logformat v0.0.0-20210106032603-24d066f940f8

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
110110
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
111111
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
112112
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
113+
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
114+
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
113115
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
114116
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
115117
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=

0 commit comments

Comments
 (0)