postburner 1.0.0.pre.8 → 1.0.0.pre.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/postburner/application_job.rb +1 -1
- data/lib/postburner/configuration.rb +9 -4
- data/lib/postburner/version.rb +1 -1
- data/lib/postburner.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d70db5c9a39d758ab94b917a9bddd996ccaa5de1520180ab07d0e228ea1ed24
|
|
4
|
+
data.tar.gz: a2df7d54ebf98e399d212d98f3aa7c3589f68ae7912b38b31bf060bbe1350928
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1346d6ad7b6edb4abaff3eaba39c0bb5572bb9042cec8c6e31876c8b202da6b841d995f567b990545d74adc5d45c5040752077af5acd785bdf1a9fcce4336299
|
|
7
|
+
data.tar.gz: a00d649a8f2dbf7e0c5ed0ab589b6d365cd3decc9dadf33bd8a1c73865ca5e5e390823ff98d707b620c714abf41ccd648729d283a8a950dfe6dd1313c759f2aa
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'erb'
|
|
4
|
+
|
|
3
5
|
module Postburner
|
|
4
6
|
# Configuration system for Postburner workers and connections.
|
|
5
7
|
#
|
|
@@ -54,7 +56,10 @@ module Postburner
|
|
|
54
56
|
}
|
|
55
57
|
end
|
|
56
58
|
|
|
57
|
-
# Loads configuration from a YAML file.
|
|
59
|
+
# Loads configuration from a YAML file with ERB support.
|
|
60
|
+
#
|
|
61
|
+
# Supports ERB templating like Rails' database.yml, allowing environment
|
|
62
|
+
# variables and Ruby expressions in configuration.
|
|
58
63
|
#
|
|
59
64
|
# @param path [String] Path to YAML configuration file
|
|
60
65
|
# @param env [String] Environment name (e.g., 'production', 'development')
|
|
@@ -73,10 +78,10 @@ module Postburner
|
|
|
73
78
|
# @example Multiple workers (must specify)
|
|
74
79
|
# config = Postburner::Configuration.load_yaml('config/postburner.yml', 'production', 'imports')
|
|
75
80
|
#
|
|
76
|
-
# @example config/postburner.yml
|
|
81
|
+
# @example config/postburner.yml with ERB
|
|
77
82
|
#
|
|
78
83
|
# default: &default
|
|
79
|
-
# beanstalk_url: beanstalk://localhost:11300
|
|
84
|
+
# beanstalk_url: <%= ENV.fetch('BEANSTALK_URL', 'beanstalk://localhost:11300') %>
|
|
80
85
|
# default_priority: 131072 # change default priority from 65536 to 131072
|
|
81
86
|
#
|
|
82
87
|
# production: # <- environment config, i.e. defaults
|
|
@@ -97,7 +102,7 @@ module Postburner
|
|
|
97
102
|
# - data_processing
|
|
98
103
|
#
|
|
99
104
|
def self.load_yaml(path, env = 'development', worker_name = nil)
|
|
100
|
-
yaml = YAML.
|
|
105
|
+
yaml = YAML.load(ERB.new(File.read(path)).result, aliases: true)
|
|
101
106
|
# env_config = top-level environment config (development:, production:, etc.)
|
|
102
107
|
env_config = yaml[env.to_s] || yaml[env.to_sym]
|
|
103
108
|
|
data/lib/postburner/version.rb
CHANGED
data/lib/postburner.rb
CHANGED
|
@@ -121,8 +121,8 @@ module Postburner
|
|
|
121
121
|
self.queue_strategy = Postburner::NiceQueue
|
|
122
122
|
|
|
123
123
|
# Auto-detect Rails test mode and switch to TestQueue
|
|
124
|
-
if defined?(Rails) && Rails.env.test? && defined?(ActiveJob::Base)
|
|
125
|
-
if ActiveJob::Base.queue_adapter_name == :test
|
|
124
|
+
if defined?(Rails) && Rails.env.test? && defined?(::ActiveJob::Base)
|
|
125
|
+
if ::ActiveJob::Base.queue_adapter_name == :test
|
|
126
126
|
self.queue_strategy = Postburner::TestQueue
|
|
127
127
|
end
|
|
128
128
|
end
|