dry-stack 0.0.85 → 0.0.86

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: f8f1e3847018ae24bd44d57813f7fb37afaa95e1a2697426eea8a40593dc07bd
4
- data.tar.gz: 5c64bd98e446a32f0edc36e98b5ef48e8812dc29183786e30f70263865dee2c2
3
+ metadata.gz: '0030379ed099994251cd619cde54371206b3cc12028e7fb2a17b6d56296f0e37'
4
+ data.tar.gz: 6aa330ee8d7456a70eba51f961a4084c5a466b3ff0e3dfd819dc58ffa24452d4
5
5
  SHA512:
6
- metadata.gz: 06bf607c465894d9b640b04c9209cca967a7430958281ff45d61501f67705c715cd5afa6cf7d93532619b7f27947d1eb8b33e3ff217364e74bb888fad087460d
7
- data.tar.gz: bf1de07565b2adf380ae0189ea6f257c052793372c542070425bf779e087e8dd6f9183082852e84d6b59fe2c67d40313a65cc351cc855671a5ce744b1bf6cdf7
6
+ metadata.gz: 57a60be8b72a438f818904b412970e49f26fbe049cb5a926ca30d3d8414b7e7cdba1aded7c7b7d00efbcb6a2f873807a0f11a4c8b1bf339c9ca1400802e09315
7
+ data.tar.gz: 6a7359355a1068dda4ef13873742ae3603925c868cf55b1a30ec98a798a2e11850dfad3846bfbd4938d9419d0aec734d90181b8f240573dcb44d5f4e2ff57c18
@@ -58,7 +58,6 @@ module Dry
58
58
  def logging(opts) = (@service[:logging] ||= {}).merge! opts
59
59
  def user(user) = @service[:user] = user # "${UID}:${GID}", "www-data:www-data"
60
60
  def network(names) = (@service[:networks] ||= []) << names
61
- def basic_auth(user_and_password) = @service[:basic_auth] = user_and_password
62
61
  def ingress(ing) = ((@service[:ingress] ||=[]) << ing).flatten!
63
62
  end
64
63
 
@@ -173,14 +172,6 @@ module Dry
173
172
  ingress[0][:port] ||= service[:ports]&.first
174
173
 
175
174
  ingress.each_with_index do |ing, index|
176
-
177
- if service[:basic_auth]
178
- ba_user, ba_password, salt = service[:basic_auth].split ':'
179
- hashed_password = apr1_crypt ba_password, (salt || rand(36**8).to_s(36))
180
- service[:deploy][:labels] << "traefik.http.middlewares.#{service_name}-#{index}_auth.basicauth.users=#{ba_user}:#{hashed_password.gsub('$','$$')}"
181
- service[:deploy][:labels] << "traefik.http.routers.#{service_name}-#{index}.middlewares=#{service_name}-#{index}_auth"
182
- end
183
-
184
175
  ing[:port] ||= service[:ports]&.first
185
176
  service[:deploy][:labels] += [
186
177
  "traefik.http.routers.#{service_name}-#{index}.service=#{service_name}-#{index}",
@@ -200,9 +191,18 @@ module Dry
200
191
 
201
192
  rule = []
202
193
  rule << "HostRegexp(`{name:#{nginx_host2regexp ing[:host]}}`)" if ing[:host]
194
+ rule << "ClientIP(#{[ing[:client_ip]].flatten.map{ "`#{_1}`" }.join ','})" if ing[:client_ip]
203
195
  rule << "PathPrefix(`#{nginx_host2regexp ing[:path]}`)" if ing[:path]
204
196
  rule << "#{ing[:rule]}" if ing[:rule]
205
197
 
198
+ if ing[:basic_auth]
199
+ ba_user, ba_password, salt = ing[:basic_auth].split ':'
200
+ hashed_password = apr1_crypt ba_password, (salt || rand(36**8).to_s(36))
201
+ service[:deploy][:labels] << "traefik.http.middlewares.#{service_name}-#{index}_auth.basicauth.users=#{ba_user}:#{hashed_password.gsub('$','$$')}"
202
+ service[:deploy][:labels] << "traefik.http.routers.#{service_name}-#{index}.middlewares=#{service_name}-#{index}_auth"
203
+ end
204
+
205
+
206
206
  service[:deploy][:labels] << "traefik.http.routers.#{service_name}-#{index}.rule=#{rule.join ' && '}"
207
207
 
208
208
  if ing[:path_sub]
@@ -214,7 +214,6 @@ module Dry
214
214
  end
215
215
  end
216
216
  end
217
- service.delete :basic_auth
218
217
  service.delete :ingress
219
218
 
220
219
  service[:environment] = @environment[name].merge(service[:environment]) if @environment[name]
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.0.85'
3
+ VERSION = '0.0.86'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.85
4
+ version: 0.0.86
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-04 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake