File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package env
33import "errors"
44
55var (
6+ ErrNilLoader = errors .New ("loader cannot be nil" )
67 ErrEnvironmentVariableNotFound = "environment variable not found: %v"
78 ErrFailedToLoadEnvironmentVariables = errors .New ("failed to load environment variables" )
89 ErrInvalidDuration = "invalid key '%v' duration value: %v"
Original file line number Diff line number Diff line change @@ -12,11 +12,16 @@ type Port struct {
1212}
1313
1414// LoadPort load port from environment variables
15- func LoadPort (host string , key string ) (
15+ func LoadPort (loader goloaderenv. Loader , host string , key string ) (
1616 * Port , error ,
1717) {
18+ // Check if loader is nil
19+ if loader == nil {
20+ return nil , goloaderenv .ErrNilLoader
21+ }
22+
1823 // Get environment variable
19- port , err := goloaderenv .LoadVariable (key )
24+ port , err := loader .LoadVariable (key )
2025 if err != nil {
2126 return nil , err
2227 }
You can’t perform that action at this time.
0 commit comments