File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 2929 config . cache_store = :memory_store
3030
3131 # Store uploaded files on the local file system (see config/storage.yml for options).
32+ # Active Storage
3233 config . active_storage . service = :local
33- Rails . application . routes . default_url_options [ :host ] ||= "http://localhost:3000"
34+
35+ # URL helpers, *_url helpers, mailers
36+ Rails . application . routes . default_url_options [ :host ] ||= "localhost:3000"
37+
38+ # blob.url, disk service
39+ config . after_initialize do
40+ ActiveStorage ::Current . url_options = {
41+ protocol : "http" ,
42+ host : "localhost" ,
43+ port : 3000
44+ }
45+ end
3446
3547 # Don't care if the mailer can't send.
3648 config . action_mailer . raise_delivery_errors = false
Original file line number Diff line number Diff line change 4949 # Store uploaded files on the digitalocean (see config/storage.yml for options).
5050 config . active_storage . service = :digitalocean
5151
52- Rails . application . routes . default_url_options [ :host ] = ENV . fetch ( "APP_HOST" , "localhost" )
52+ app_host = ENV . fetch ( "APP_HOST" , "localhost" )
53+
54+ Rails . application . routes . default_url_options [ :host ] = app_host
55+
56+ config . after_initialize do
57+ ActiveStorage ::Current . url_options = {
58+ protocol : Rails . env . production? ? "https" : "http" ,
59+ host : app_host
60+ }
61+ end
5362
5463 # Assume all access to the app is happening through a SSL-terminating reverse proxy.
5564 config . assume_ssl = true
Original file line number Diff line number Diff line change 22
33# Override production settings here
44Rails . application . configure do
5+ # Attachment handling
6+ config . active_storage . service = :digitalocean
7+ app_host = ENV . fetch ( "APP_HOST" , "localhost" )
8+ Rails . application . routes . default_url_options [ :host ] = app_host
9+ config . after_initialize do
10+ ActiveStorage ::Current . url_options = {
11+ protocol : Rails . env . development? ? "http" : "https" ,
12+ host : app_host
13+ }
14+ end
515end
You can’t perform that action at this time.
0 commit comments