We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 333cc2c commit 5c72a1eCopy full SHA for 5c72a1e
1 file changed
internal/app/traefik-github-oauth-server/config.go
@@ -19,14 +19,21 @@ type Config struct {
19
GithubOauthScopes []string
20
}
21
22
-func envString(key string) string {
23
- fileKey := key + "_FILE"
24
- if value := os.Getenv(fileKey); value != "" {
+func envFromFile(key string) string {
+ fileEnvKey := key + "_FILE"
+
25
+ if value := os.Getenv(fileEnvKey); value != "" {
26
content, err := os.ReadFile(value)
- if err != nil {
27
- return os.Getenv(key)
+ if err == nil {
28
+ return strings.TrimSpace(string(content))
29
- return strings.TrimSpace(string(content))
30
+ }
31
+ return ""
32
+}
33
34
+func envString(key string) string {
35
+ if value := envFromFile(key); value != "" {
36
+ return value
37
38
return os.Getenv(key)
39
0 commit comments