appydays 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appydays/dotenviable.rb +17 -0
- data/lib/appydays/loggable.rb +11 -2
- data/lib/appydays/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191701f151a4b25333ee5f6cc1262e70c4d62dc063350bbebd4d00798cb2128e
|
4
|
+
data.tar.gz: 05d188d89e2db3047837f59784773284aa194f9435c2d6f83a8d8bc84b7c06d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd5f3a2c5ebfc6d172992e98ed34d6eb33a581b5ef3c55cb0744491cdb22274c9e519af561aba1014dedd68606be9b714e8c7bf5aa9d6deb4b849cbd7115ec1c
|
7
|
+
data.tar.gz: fd5c9afa41fa2d9ededce48760d147339029c29c21e9679e3d58cbf43f544419a95201634c8626413718da52eac91262fead6515361e2fd7017901e355ed5171
|
data/lib/appydays/dotenviable.rb
CHANGED
@@ -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
|
data/lib/appydays/loggable.rb
CHANGED
@@ -72,8 +72,17 @@ module Appydays::Loggable
|
|
72
72
|
SemanticLogger.add_appender(io: $stdout, formatter: format.to_sym)
|
73
73
|
end
|
74
74
|
|
75
|
-
def self.with_log_tags(tags
|
76
|
-
|
75
|
+
def self.with_log_tags(tags)
|
76
|
+
if defined?(Sentry)
|
77
|
+
Sentry.configure_scope do |scope|
|
78
|
+
scope.set_extras(tags)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
blockresult = nil
|
82
|
+
SemanticLogger.named_tagged(tags) do
|
83
|
+
blockresult = yield
|
84
|
+
end
|
85
|
+
return blockresult
|
77
86
|
end
|
78
87
|
|
79
88
|
@stderr_appended = false
|
data/lib/appydays/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lithic Tech
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -237,8 +237,8 @@ dependencies:
|
|
237
237
|
description: 'appydays provides support for env-based configuration, and common structured
|
238
238
|
logging capabilities
|
239
239
|
|
240
|
-
'
|
241
|
-
email:
|
240
|
+
'
|
241
|
+
email:
|
242
242
|
executables: []
|
243
243
|
extensions: []
|
244
244
|
extra_rdoc_files: []
|
@@ -259,7 +259,7 @@ licenses:
|
|
259
259
|
- MIT
|
260
260
|
metadata:
|
261
261
|
rubygems_mfa_required: 'true'
|
262
|
-
post_install_message:
|
262
|
+
post_install_message:
|
263
263
|
rdoc_options: []
|
264
264
|
require_paths:
|
265
265
|
- lib
|
@@ -274,8 +274,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
- !ruby/object:Gem::Version
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
278
|
-
signing_key:
|
277
|
+
rubygems_version: 3.3.3
|
278
|
+
signing_key:
|
279
279
|
specification_version: 4
|
280
280
|
summary: Provides support for env-based configuration, and common structured logging
|
281
281
|
capabilities
|