File tree Expand file tree Collapse file tree 2 files changed +19
-26
lines changed Expand file tree Collapse file tree 2 files changed +19
-26
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import (
55 "errors"
66 "fmt"
77 "io"
8+ "log/slog"
89 "os"
910 "path/filepath"
1011
12+ "github.com/joho/godotenv"
1113 "github.com/pelletier/go-toml/v2"
1214 "golang.org/x/term"
1315)
2325 DispatchConsoleUrl string
2426
2527 DispatchConfigPath string
28+
29+ DotEnvFilePath string
2630)
2731
2832func init () {
@@ -148,3 +152,18 @@ func runConfigFlow() error {
148152 }
149153 return nil
150154}
155+
156+ func loadEnvFromFile (path string ) error {
157+ if path != "" {
158+ absolutePath , err := filepath .Abs (path )
159+ if err != nil {
160+ return fmt .Errorf ("failed to get absolute path for %s: %v" , path , err )
161+ }
162+ if err := godotenv .Load (path ); err != nil {
163+ return fmt .Errorf ("failed to load env file from %s: %v" , absolutePath , err )
164+ }
165+ slog .Info ("loading environment variables from file" , "path" , absolutePath )
166+ }
167+ setVariables ()
168+ return nil
169+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments