We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2c48868 + 0bbb8c8 commit 9417b80Copy full SHA for 9417b80
app/infrastructure/env.go
@@ -3,6 +3,7 @@ package infrastructure
3
import (
4
"bufio"
5
"os"
6
+ "regexp"
7
"strings"
8
9
"github.com/bmf-san/go-clean-architecture-web-application-boilerplate/app/usecases"
@@ -28,7 +29,12 @@ func Load(logger usecases.Logger) {
28
29
}
30
31
for _, l := range lines {
- pair := strings.Split(l, "=")
32
- os.Setenv(pair[0], pair[1])
+ pair := regexp.MustCompile(`=`).Split(l, 2)
33
+
34
+ if len(pair) > 1 {
35
+ os.Setenv(strings.TrimSpace(pair[0]), strings.TrimSpace(pair[1]))
36
+ } else {
37
+ logger.LogError(".env file. Wrong format for " + pair[0])
38
+ }
39
40
0 commit comments