Skip to content

Commit ef2cc78

Browse files
committed
fix: load sim.env without .env
1 parent 537d439 commit ef2cc78

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cmd/sim/cmd_sim.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import (
1818

1919
func main() {
2020
// load .env
21-
_ = godotenv.Load(".env", "sim.env")
21+
_ = godotenv.Load(".env")
22+
_ = godotenv.Load("sim.env")
2223

2324
// init the simulator
2425
ctx := context.Background()

pkg/psmon/psmon.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ type PSMon struct {
5454

5555
func NewPSMon(endpoint string, newOtelProvider NewOtelProviderFn) *PSMon {
5656

57+
// load .env
58+
_ = godotenv.Load(".env")
59+
5760
// load bench.env, but not in sim
5861
isSim := strings.HasSuffix(os.Args[0], "sim") ||
5962
strings.HasSuffix(os.Args[0], "sim_go")
6063
if !isSim {
61-
_ = godotenv.Load(".env", "bench.env")
64+
_ = godotenv.Load("bench.env")
6265
}
6366

64-
// load .env
65-
_ = godotenv.Load(".env")
66-
6767
ep := endpoint
6868
if ep == "" {
6969
ep = OtelEndpoint

0 commit comments

Comments
 (0)