mirror of
https://github.com/joho/godotenv.git
synced 2025-08-02 04:25:57 +00:00
Compare commits
1 Commits
v1.6.0-pre
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
805932dc80 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
os: [ ubuntu-latest, macOS-latest, windows-latest ]
|
||||
name: ${{ matrix.os }} Go ${{ matrix.go }} Tests
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Generate build files
|
||||
uses: thatisuday/go-cross-build@v1.0.2
|
||||
with:
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
|
@ -3,4 +3,3 @@ OPTION_B=${OPTION_A}
|
||||
OPTION_C=$OPTION_B
|
||||
OPTION_D=${OPTION_A}${OPTION_B}
|
||||
OPTION_E=${OPTION_NOT_DEFINED}
|
||||
OPTION_F=${GLOBAL_OPTION}
|
||||
|
@ -207,21 +207,15 @@ func TestLoadQuotedEnv(t *testing.T) {
|
||||
|
||||
func TestSubstitutions(t *testing.T) {
|
||||
envFileName := "fixtures/substitutions.env"
|
||||
|
||||
presets := map[string]string{
|
||||
"GLOBAL_OPTION": "global",
|
||||
}
|
||||
|
||||
expectedValues := map[string]string{
|
||||
"OPTION_A": "1",
|
||||
"OPTION_B": "1",
|
||||
"OPTION_C": "1",
|
||||
"OPTION_D": "11",
|
||||
"OPTION_E": "",
|
||||
"OPTION_F": "global",
|
||||
}
|
||||
|
||||
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, presets)
|
||||
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets)
|
||||
}
|
||||
|
||||
func TestExpanding(t *testing.T) {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode"
|
||||
@ -265,12 +264,6 @@ func expandVariables(v string, m map[string]string) string {
|
||||
if submatch[1] == "\\" || submatch[2] == "(" {
|
||||
return submatch[0][1:]
|
||||
} else if submatch[4] != "" {
|
||||
if val, ok := m[submatch[4]]; ok {
|
||||
return val
|
||||
}
|
||||
if val, ok := os.LookupEnv(submatch[4]); ok {
|
||||
return val
|
||||
}
|
||||
return m[submatch[4]]
|
||||
}
|
||||
return s
|
||||
|
Reference in New Issue
Block a user