dotenv 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dotenv/rails.rb +5 -10
- data/lib/dotenv/replay_logger.rb +8 -8
- data/lib/dotenv/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2ff4f17537b901cd35363188bcf31b756e7eab87039d76a43ffcf4196c474e2
|
4
|
+
data.tar.gz: a7703a4ccf3f72491896e8ded3289b457e610323ce0b8276bdd96eb2af15be18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fdb56b5a23015afb5e86de500a0a14e57fb07332317d552052f200aa4a86e57e6f452b24f6195dc910258d78d467f98748cefbfb225cc3a8c1ddbbf0c145795
|
7
|
+
data.tar.gz: c7cce79b3636e16388a4e1573865933c0f12a111316404d475d87cd1c06dc4f27565a6e1ffa34b34483aa577f57c42ea614cf75b33752fcc8985fe540a421488
|
data/lib/dotenv/rails.rb
CHANGED
@@ -4,7 +4,6 @@ unless Gem::Requirement.new(">= 6.1").satisfied_by?(Gem::Version.new(Rails.versi
|
|
4
4
|
return
|
5
5
|
end
|
6
6
|
|
7
|
-
require "dotenv"
|
8
7
|
require "dotenv/replay_logger"
|
9
8
|
require "dotenv/log_subscriber"
|
10
9
|
|
@@ -24,7 +23,7 @@ end
|
|
24
23
|
module Dotenv
|
25
24
|
# Rails integration for using Dotenv to load ENV variables from a file
|
26
25
|
class Rails < ::Rails::Railtie
|
27
|
-
delegate :files=, :overwrite, :overwrite=, :autorestore, :autorestore=, :logger, :logger=, to: "config.dotenv"
|
26
|
+
delegate :files, :files=, :overwrite, :overwrite=, :autorestore, :autorestore=, :logger, :logger=, to: "config.dotenv"
|
28
27
|
|
29
28
|
def initialize
|
30
29
|
super()
|
@@ -42,22 +41,17 @@ module Dotenv
|
|
42
41
|
)
|
43
42
|
end
|
44
43
|
|
45
|
-
# The list of files to load, joined with Rails.root
|
46
|
-
def files
|
47
|
-
config.dotenv.files.map { |file| root.join(file) }
|
48
|
-
end
|
49
|
-
|
50
44
|
# Public: Load dotenv
|
51
45
|
#
|
52
46
|
# This will get called during the `before_configuration` callback, but you
|
53
47
|
# can manually call `Dotenv::Rails.load` if you needed it sooner.
|
54
48
|
def load
|
55
|
-
Dotenv.load(*files, overwrite: overwrite)
|
49
|
+
Dotenv.load(*files.map { |file| root.join(file).to_s }, overwrite: overwrite)
|
56
50
|
end
|
57
51
|
|
58
52
|
def overload
|
59
53
|
deprecator.warn("Dotenv::Rails.overload is deprecated. Set `Dotenv::Rails.overwrite = true` and call Dotenv::Rails.load instead.")
|
60
|
-
Dotenv.load(*files, overwrite: true)
|
54
|
+
Dotenv.load(*files.map { |file| root.join(file).to_s }, overwrite: true)
|
61
55
|
end
|
62
56
|
|
63
57
|
# Internal: `Rails.root` is nil in Rails 4.1 before the application is
|
@@ -95,7 +89,8 @@ module Dotenv
|
|
95
89
|
|
96
90
|
initializer "dotenv", after: :initialize_logger do |app|
|
97
91
|
# Set up a new logger once Rails has initialized the logger and replay logs
|
98
|
-
new_logger =
|
92
|
+
new_logger = ::Rails.logger
|
93
|
+
new_logger = new_logger.tagged("dotenv") if new_logger.respond_to?(:tagged)
|
99
94
|
logger.replay new_logger if logger.respond_to?(:replay)
|
100
95
|
self.logger = new_logger
|
101
96
|
end
|
data/lib/dotenv/replay_logger.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module Dotenv
|
2
2
|
# A logger that can be used before the apps real logger is initialized.
|
3
|
-
class ReplayLogger
|
3
|
+
class ReplayLogger < Logger
|
4
4
|
def initialize
|
5
|
+
super(nil) # Doesn't matter what this is, it won't be used.
|
5
6
|
@logs = []
|
6
7
|
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def respond_to_missing?(name, include_private = false)
|
13
|
-
(include_private ? Logger.instance_methods : Logger.public_instance_methods).include?(name) || super
|
9
|
+
# Override the add method to store logs so we can replay them to a real logger later.
|
10
|
+
def add(*args, &block)
|
11
|
+
@logs.push([args, block])
|
14
12
|
end
|
15
13
|
|
14
|
+
# Replay the store logs to a real logger.
|
16
15
|
def replay(logger)
|
17
|
-
@logs.each { |
|
16
|
+
@logs.each { |args, block| logger.add(*args, &block) }
|
17
|
+
@logs.clear
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
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.0.
|
4
|
+
version: 3.0.3
|
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-02-
|
11
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -84,7 +84,7 @@ homepage: https://github.com/bkeepers/dotenv
|
|
84
84
|
licenses:
|
85
85
|
- MIT
|
86
86
|
metadata: {}
|
87
|
-
post_install_message:
|
87
|
+
post_install_message:
|
88
88
|
rdoc_options: []
|
89
89
|
require_paths:
|
90
90
|
- lib
|
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
102
|
+
rubygems_version: 3.4.10
|
103
|
+
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Loads environment variables from `.env`.
|
106
106
|
test_files: []
|