appydays 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfd157bff00c9a41a678f4f8877660e90f9bb094b367ea0bedf153d7ea30d528
4
- data.tar.gz: 4da1794259b8f5a2ad0d43544092487b91b56f840439404567ca26467264c8d8
3
+ metadata.gz: 191701f151a4b25333ee5f6cc1262e70c4d62dc063350bbebd4d00798cb2128e
4
+ data.tar.gz: 05d188d89e2db3047837f59784773284aa194f9435c2d6f83a8d8bc84b7c06d3
5
5
  SHA512:
6
- metadata.gz: 85e0c276cb7978298f3a14fadfa71e767b216b2fd419beecda09fe6855eea3de8cf58e9651869eae45a1317a47df659ff0db69de8daf29533040f190eaac07b2
7
- data.tar.gz: 0d07c35465caebd19c9cb86a3d2113cdd1bacebe80cfedd2251da076fdaadec46d0fa47c5e147e9c3fee78ec7b1afff39291ea30057b20e562c28010af4710dc
6
+ metadata.gz: dd5f3a2c5ebfc6d172992e98ed34d6eb33a581b5ef3c55cb0744491cdb22274c9e519af561aba1014dedd68606be9b714e8c7bf5aa9d6deb4b849cbd7115ec1c
7
+ data.tar.gz: fd5c9afa41fa2d9ededce48760d147339029c29c21e9679e3d58cbf43f544419a95201634c8626413718da52eac91262fead6515361e2fd7017901e355ed5171
@@ -24,6 +24,13 @@ require "appydays/version"
24
24
  # it won't get used, because .env files don't stomp what is already in the environment
25
25
  # (we don't want to use `overload`).
26
26
  # So we have some trickery to overwrite only PORT.
27
+ #
28
+ # @param rack_env [nil,String] Value like 'development' or 'production' to use to load .env files.
29
+ # If not given, use +env['RACK_ENV']+ or +default_rack_env+.
30
+ # @param default_rack_env [String] If +env['RACK_ENV']+ is not set, use this value.
31
+ # @param env [Hash] Hash to read and mutate.
32
+ # Pass in a different hash to load environment variables into it instead of ENV.
33
+ # Useful for testing, or to get the config for another environment.
27
34
  module Appydays::Dotenviable
28
35
  def self.load(rack_env: nil, default_rack_env: "development", env: ENV)
29
36
  original_port = env.delete("PORT")
@@ -33,7 +40,17 @@ module Appydays::Dotenviable
33
40
  ".env.#{rack_env}",
34
41
  ".env",
35
42
  ]
43
+ orig_env = nil
44
+ if env.object_id != ENV.object_id
45
+ orig_env = ENV.to_h
46
+ ENV.replace(env)
47
+ end
36
48
  Dotenv.load(*paths)
49
+ if orig_env
50
+ env.merge!(ENV)
51
+ ENV.replace(orig_env)
52
+ end
53
+
37
54
  env["PORT"] ||= original_port
38
55
  env["RACK_ENV"] ||= rack_env
39
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appydays
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appydays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lithic Tech
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-27 00:00:00.000000000 Z
11
+ date: 2024-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv