dotenv 3.1.5 → 3.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dotenv/parser.rb +8 -8
- data/lib/dotenv/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4ad122f937755147ff0cc52552f17b1e1cf8f9a290ff791ac5ba2f8ef8b43c7
|
4
|
+
data.tar.gz: 3116d767ea5dc67adca867395ea7effbc1b4ee30769223961f8d041d5c34482d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86436a8b6d193590befeb48a29882b9bd5523f8b80fff961faf1feda91cc720b8b44c1e2705bfbebb73836b99684273d49f78b94c09d05a3077e62996473a47c
|
7
|
+
data.tar.gz: bb6f98a159c821e0f1cb98ab6c3f0b54a109acc3c934770fd6603f7497c047f031c7124f839963f0f5132a12bd2736e25ab2e4c648cfa56589a30b328d03de61
|
data/lib/dotenv/parser.rb
CHANGED
@@ -43,7 +43,7 @@ module Dotenv
|
|
43
43
|
|
44
44
|
def initialize(string, overwrite: false)
|
45
45
|
# Convert line breaks to same format
|
46
|
-
@string = string.gsub(
|
46
|
+
@string = string.gsub(/\r\n?/, "\n")
|
47
47
|
@hash = {}
|
48
48
|
@overwrite = overwrite
|
49
49
|
end
|
@@ -52,11 +52,11 @@ module Dotenv
|
|
52
52
|
@string.scan(LINE) do
|
53
53
|
match = $LAST_MATCH_INFO
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
if existing?(match[:key])
|
56
|
+
# Use value from already defined variable
|
57
|
+
@hash[match[:key]] = ENV[match[:key]]
|
58
|
+
elsif match[:export] && !match[:value]
|
59
|
+
# Check for exported variable with no value
|
60
60
|
if !@hash.member?(match[:key])
|
61
61
|
raise FormatError, "Line #{match.to_s.inspect} has an unset variable"
|
62
62
|
end
|
@@ -70,8 +70,8 @@ module Dotenv
|
|
70
70
|
|
71
71
|
private
|
72
72
|
|
73
|
-
# Determine if
|
74
|
-
def
|
73
|
+
# Determine if a variable is already defined and should not be overwritten.
|
74
|
+
def existing?(key)
|
75
75
|
!@overwrite && key != "DOTENV_LINEBREAK_MODE" && ENV.key?(key)
|
76
76
|
end
|
77
77
|
|
data/lib/dotenv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Keepers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -85,7 +85,7 @@ licenses:
|
|
85
85
|
- MIT
|
86
86
|
metadata:
|
87
87
|
changelog_uri: https://github.com/bkeepers/dotenv/releases
|
88
|
-
post_install_message:
|
88
|
+
post_install_message:
|
89
89
|
rdoc_options: []
|
90
90
|
require_paths:
|
91
91
|
- lib
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubygems_version: 3.5.22
|
104
|
-
signing_key:
|
104
|
+
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Loads environment variables from `.env`.
|
107
107
|
test_files: []
|