dotenv instead of Rails credentials

The deployment is done on a Dokku server. It sets the DATABASE_URL
automatically.
This commit is contained in:
Christoph Haas 2025-04-07 22:25:55 +02:00
parent 85d12b5c77
commit e4af4c21ae
6 changed files with 12 additions and 17 deletions

View file

@ -124,9 +124,6 @@ GEM
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
dotenv (3.1.7) dotenv (3.1.7)
dotenv-rails (3.1.7)
dotenv (= 3.1.7)
railties (>= 6.1)
down (5.4.2) down (5.4.2)
addressable (~> 2.8) addressable (~> 2.8)
drb (2.2.1) drb (2.2.1)
@ -575,7 +572,7 @@ DEPENDENCIES
cssbundling-rails cssbundling-rails
debug debug
devise devise
dotenv-rails dotenv
factory_bot_rails factory_bot_rails
fastimage fastimage
font-awesome-rails font-awesome-rails

BIN
bun.lockb

Binary file not shown.

View file

@ -1 +0,0 @@
p4iCDmwxjQ5zC6i3QVNCnlW++oxVLD0AKnflI6lsRBQ1bLTcBA3+8EFI9itIiv7WUJYF+0xGz1bqNq8e9Kk+tEq7C1GVgbuS3xEjG2I0Kt1GbTjvl0aeCd7WHR5xWHlCIXmZVhO/OL4SNc876WYpQqwWRwHkPND0QGAmfWOgy2H14V6LVYh1d7fhPdSYBr4b6oPMMQW6fqAjQ8Oq5TVUznRiRLQfFhAYz2DklMAoASjhAWK39U76JWYqu8VCq08+3V/geXYtQfcsvQ1twq08RFcJbZsCG7slOI8fPW5Oq2dCpw==--mvh3V6FOm1I5+pal--y0AKTyuXuwhXl6iMcT29tw==

View file

@ -9,7 +9,7 @@ production:
primary: primary:
<<: *default <<: *default
# database: storage/production.sqlite3 # database: storage/production.sqlite3
url: <%= Rails.application.credentials.db.url %> url: <%= ENV['DATABASE_URL'] %>
pool: 10 pool: 10
cache: cache:
<<: *default <<: *default

View file

@ -1,4 +1,4 @@
require "active_support/core_ext/integer/time" require 'active_support/core_ext/integer/time'
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
@ -17,10 +17,10 @@ Rails.application.configure do
# Enable/disable Action Controller caching. By default Action Controller caching is disabled. # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
# Run rails dev:cache to toggle Action Controller caching. # Run rails dev:cache to toggle Action Controller caching.
if Rails.root.join("tmp/caching-dev.txt").exist? if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true config.action_controller.enable_fragment_cache_logging = true
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } config.public_file_server.headers = { 'cache-control' => "public, max-age=#{2.days.to_i}" }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
end end
@ -34,12 +34,12 @@ Rails.application.configure do
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: 'localhost', address: 'localhost',
port: 25, port: 25,
enable_starttls_auto: false enable_starttls_auto: false
} }
config.action_mailer.default_url_options = { config.action_mailer.default_url_options = {
host: "screenshots.debian.net", host: 'screenshots.debian.net',
protocol: 'https' protocol: 'https'
} }
@ -47,7 +47,7 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Set localhost to be used by links generated in mailer templates. # Set localhost to be used by links generated in mailer templates.
config.action_mailer.default_url_options = { host: "localhost", port: 3000 } config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
@ -77,8 +77,8 @@ Rails.application.configure do
config.package_sources = [ config.package_sources = [
{ {
description: 'Debian Unstable (Sid)', type: 'apt', url: 'http://ftp.de.debian.org/debian/dists/sid', description: 'Debian Unstable (Sid)', type: 'apt', url: 'http://ftp.de.debian.org/debian/dists/sid',
architectures: ['i386' ,'amd64'] architectures: %w[i386 amd64]
#components: ['main','restricted','universe','multiverse'] # components: ['main','restricted','universe','multiverse']
} }
] ]
@ -101,4 +101,3 @@ Rails.application.configure do
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`. # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate! # config.generators.apply_rubocop_autocorrect_after_generate!
end end

View file

@ -53,7 +53,7 @@ Rails.application.configure do
config.active_job.queue_adapter = :solid_queue config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :queue } } config.solid_queue.connects_to = { database: { writing: :queue } }
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: Rails.application.credentials.smtp.server, address: ENV['SMTP_SERVER'],
port: 25, port: 25,
enable_starttls_auto: false enable_starttls_auto: false
} }