dockerfile-rails 1.6.20 → 1.6.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97b00e2bf3497486dd4bde825bdf67c805f9e4f5293a7c9ba279ae559324f4a1
4
- data.tar.gz: 1a1cb3c9fbadc0d6e28b332a9d5bdadb4354aa8a6924dccc353dfd698eb68d82
3
+ metadata.gz: b937cd3cb1aac852332cec69d74844548ec84a2a891cf46effd2a1e8ebbbba39
4
+ data.tar.gz: e4038b8e3c87c7ff294d1272c4ff5bd2f59fd0247ab9f5da860994baf50fbbd1
5
5
  SHA512:
6
- metadata.gz: 2c916667f7f12930ede3c0279a852a7f32d2433f69acd69626630a71de2d206b5f36f9448ccf7db09097684f718ce29899741a442e506027fd260efc7b489095
7
- data.tar.gz: 7f96dc124502e009d955e4886d0848775e962ccd935f165b4c71d6abc50e889b0f04da64ca0844038a913606b36dca33068f4bbb08e54c22343e05eba87c9a81
6
+ metadata.gz: 7af874f91e9b92a374f628cb822e5513827a65511631b5c9678c90183dd33f252037cb03e02ef20c5b121014ad09413088da73969b6d8ca2bb88e6d2791417d5
7
+ data.tar.gz: c600be2fcc77d4228ffa6d8acc3e5d3ce342576be8f4f986bc3e0fbe4022f2f9f3911c5be83c3e96548c3445680f830837cbe230c663cc16d72f94758f9541ce
@@ -331,7 +331,10 @@ class DockerfileGenerator < Rails::Generators::Base
331
331
 
332
332
  template "docker-compose.yml.erb", "docker-compose.yml" if options.compose
333
333
 
334
- template "database.yml.erb", "config/database.yml" if fix_database_config
334
+ if fix_database_config
335
+ template "database.yml.erb", "config/database.yml",
336
+ force: File.exist?("fly.toml")
337
+ end
335
338
 
336
339
  if using_litefs?
337
340
  template "litefs.yml.erb", "config/litefs.yml"
@@ -413,11 +416,23 @@ class DockerfileGenerator < Rails::Generators::Base
413
416
  STDERR.puts 'RUN sed -i "/net-pop (0.1.2)/a\ net-protocol" Gemfile.lock'
414
417
  end
415
418
 
416
- if (options.sqlite3? || @sqlite3) && !dockerfile.include?("DATABASE_URL") && File.exist?("fly.toml")
417
- toml = IO.read("fly.toml")
418
- if !toml.include?("[[env]]")
419
- toml += "\n[[env]]\n DATABASE_URL = \"sqlite3:///data/production.sqlite3\"\n"
420
- File.write "fly.toml", toml
419
+ if File.exist?("fly.toml")
420
+ env = {}
421
+
422
+ if (options.sqlite3? || @sqlite3) && !dockerfile.include?("DATABASE_URL")
423
+ env["DATABASE_URL"] = "sqlite3:///data/production.sqlite3"
424
+ end
425
+
426
+ if using_thruster? && !dockerfile.include?("HTTP_PORT")
427
+ env["HTTP_PORT"] = "8080"
428
+ end
429
+
430
+ unless env.empty?
431
+ toml = IO.read("fly.toml")
432
+ if !toml.include?("[[env]]")
433
+ toml += "\n[[env]]\n" + env.map { |key, value| " #{key} = #{value.inspect}" }.join("\n")
434
+ File.write "fly.toml", toml
435
+ end
421
436
  end
422
437
  end
423
438
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerfile-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.20
4
+ version: 1.6.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -37,7 +37,6 @@ files:
37
37
  - Rakefile
38
38
  - lib/dockerfile-rails.rb
39
39
  - lib/dockerfile-rails/scanner.rb
40
- - lib/fly_replay.rb
41
40
  - lib/generators/dockerfile_generator.rb
42
41
  - lib/generators/templates/Dockerfile.erb
43
42
  - lib/generators/templates/_apt_install.erb
@@ -76,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
77
  requirements: []
79
- rubygems_version: 3.5.14
78
+ rubygems_version: 3.5.18
80
79
  signing_key:
81
80
  specification_version: 4
82
81
  summary: Dockerfile generator for Rails
data/lib/fly_replay.rb DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Fly
4
- class FlyReplay
5
- def initialize(app)
6
- @app = app
7
- end
8
-
9
- def call(env)
10
- # replay /prometheus/* to the prom proxy in bubblegum
11
- if env["PATH_INFO"].starts_with?("/prometheus")
12
- return [307, { "Fly-Replay" => "app=flyio-bubblegum-api" }, []]
13
- end
14
-
15
- # replay /debug to the debug app. unsure if this is actually used
16
- if env["PATH_INFO"].starts_with?("/debug")
17
- return [307, { "Fly-Replay" => "app=debug" }, []]
18
- end
19
-
20
- @status, @headers, @response = @app.call(env)
21
-
22
- context = OpenTelemetry::Trace.current_span.context
23
- @headers["fly-trace-id"] = context.trace_id.unpack1("H*")
24
- @headers["fly-span-id"] = context.span_id.unpack1("H*")
25
-
26
- [@status, @headers, @response]
27
- end
28
- end
29
- end