dockerfile-rails 1.6.20 → 1.6.22

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: 97b00e2bf3497486dd4bde825bdf67c805f9e4f5293a7c9ba279ae559324f4a1
4
- data.tar.gz: 1a1cb3c9fbadc0d6e28b332a9d5bdadb4354aa8a6924dccc353dfd698eb68d82
3
+ metadata.gz: d57f94bd7d0ee06690024d3a5beab4dc55bc02efcd8ccd390d5ba24e046cef2f
4
+ data.tar.gz: e6d155a91c132c60a214159668ba4998d20bbb5ad3192d852c4377eed43d72e3
5
5
  SHA512:
6
- metadata.gz: 2c916667f7f12930ede3c0279a852a7f32d2433f69acd69626630a71de2d206b5f36f9448ccf7db09097684f718ce29899741a442e506027fd260efc7b489095
7
- data.tar.gz: 7f96dc124502e009d955e4886d0848775e962ccd935f165b4c71d6abc50e889b0f04da64ca0844038a913606b36dca33068f4bbb08e54c22343e05eba87c9a81
6
+ metadata.gz: ac80ebf094d7ac05106cbc7680a56452c5bca6c7d30c4a30ccb32f5e43042d50139e997a7866233c51d8c38234cf3568f06c4eafb2a3d281391a4379da256df4
7
+ data.tar.gz: 7bb349afdf55b80f8495c1034bc5b490fddc2488b110b219ffcb878f67c51c50720ec168340a72b3e5ec9854d4f97af77e3ed7ae23ae0e25d6678c901b75ea75
@@ -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.22
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