Skip to content

Commit 0621f17

Browse files
authored
Merge pull request #215 from ndeloof/godotenv
import godotenv as a subpackage
2 parents 91ed80f + 855e9ff commit 0621f17

20 files changed

+1295
-12
lines changed

cli/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import (
2424
"regexp"
2525
"strings"
2626

27+
"github.com/compose-spec/compose-go/dotenv"
2728
"github.com/compose-spec/compose-go/errdefs"
2829
"github.com/compose-spec/compose-go/loader"
2930
"github.com/compose-spec/compose-go/types"
30-
"github.com/compose-spec/godotenv"
3131
"github.com/pkg/errors"
3232
"github.com/sirupsen/logrus"
3333
)
@@ -220,7 +220,7 @@ func WithDotEnv(o *ProjectOptions) error {
220220
defer file.Close()
221221

222222
notInEnvSet := make(map[string]interface{})
223-
env, err := godotenv.ParseWithLookup(file, func(k string) (string, bool) {
223+
env, err := dotenv.ParseWithLookup(file, func(k string) (string, bool) {
224224
v, ok := os.LookupEnv(k)
225225
if !ok {
226226
notInEnvSet[k] = nil

dotenv/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 John Barton
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dotenv/fixtures/equals.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export OPTION_A='postgres://localhost:5432/database?sslmode=disable'
2+

dotenv/fixtures/exported.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export OPTION_A=2
2+
export OPTION_B='\n'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
foo=bar
2+
VAR_TO_BE_LOADED_FROM_OS_ENV
3+
bar=baz
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VARIABLE_NOT_FOUND
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VAR_TO_BE_LOADED_FROM_OS_ENV

dotenv/fixtures/invalid1.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
INVALID LINE
2+
foo=bar

dotenv/fixtures/plain.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
OPTION_A=1
2+
OPTION_B=2
3+
OPTION_C= 3
4+
OPTION_D =4
5+
OPTION_E = 5
6+
OPTION_F =
7+
OPTION_G=

dotenv/fixtures/quoted.env

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
OPTION_A='1'
2+
OPTION_B='2'
3+
OPTION_C=''
4+
OPTION_D='\n'
5+
OPTION_E="1"
6+
OPTION_F="2"
7+
OPTION_G=""
8+
OPTION_H="\n"
9+
OPTION_I = "echo 'asd'"
10+
OPTION_J = 'first line
11+
second line
12+
third line
13+
and so on'
14+
OPTION_Z = "last value"

0 commit comments

Comments
 (0)