| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
| |
|
|
|
|
| |
behavior
|
| |
|
|
|
|
|
| |
Railsties tests are broken with this new update checker so we will use
the old one until we have the tests fixed.
|
|
|
|
| |
Also call it `public_server.index_name` so it'll make more sense.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the implementation of the file update checker written
by Puneet Agarwal for GSoC 2015 (except for the tiny version
of the listen gem, which was 3.0.2 in the original patch).
Puneet's branch became too out of sync with upstream. This is
the final work in one single clean commit.
Credit goes in the first line using a convention understood
by the contrib app.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Fix the message by wrapping the value in missing quotes and adding
the missing backtick at the end. Finally, :lipstick: by adding a space
inside the curly braces.
Before:
`config.public_file_server.headers = {'Cache-Control' => public,
max-age=31536000}
Now:
`config.public_file_server.headers = { 'Cache-Control' => 'public,
max-age=31536000' }`
2. Display `static_cache_control` instead of static_cache_control. This
follows what the 2 neighboring methods are doing.
3. Use strip_heredoc to improve the code formatting and readability
like the 2 neighboring methods and wrap to 80 characters.
|
|
|
|
|
|
|
|
| |
As discussed in https://github.com/rails/rails/pull/19135#issuecomment-153385986.
Replaces `serve_static_files` to unify the static options under the `public_file_server` wing.
Deprecates `serve_static_files` accessors, but make them use the newer config internally.
|
|\
| |
| |
| | |
Add basic support for access control headers to ActionDispatch::Static
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now ActionDispatch::Static can accept HTTP headers so that developers
will have control of returning arbitrary headers like
'Access-Control-Allow-Origin' when a response is delivered. They can
be configured through `#config.public_file_server.headers`:
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=60",
"Access-Control-Allow-Origin" => "http://rubyonrails.org"
}
Also deprecate `config.static_cache_control` in favor of
`config.public_file_server.headers`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8.
Jeremy is right that we shouldn't remove this. The fact is that many
engines are depending on this middleware to be in the default stack.
This ties our hands and forces us to keep the middleware in the stack so
that engines will work. To be extremely clear, I think this is another
smell of "the rack stack" that we have in place. When manipulating
middleware, we should have meaningful names for places in the req / res
lifecycle **not** have engines depend on a particular constant be in a
particular place in the stack. This is a weakness of the API that we
have to figure out a way to address before removing the constant.
As far as timing attacks are concerned, we can reduce the granularity
such that it isn't useful information for hackers, but is still useful
for developers.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The runtime header is a potential target for timing attacks since it
returns the amount of time spent on the server (eliminating network
speed). Total time is also not accurate for streaming responses.
The middleware can be added back via:
```ruby
config.middleware.ues ::Rack::Runtime
```
|
| |
| |
| |
| |
| |
| | |
Allocating a new middleware proxy in each application configuration and
then merging the app specific config with the global config when the app
is built.
|
| |
| |
| |
| |
| | |
This can still be added to the middleware stack, but is really not
necessary. I'll follow up with a commit that deprecates the constant
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Using the string version of the class reference is now deprecated when
referencing middleware. This should be written as a class not as a string.
Deprecation warning that this change fixes:
```
DEPRECATION WARNING: Passing strings or symbols to the middleware
builder is deprecated, please change
them to actual class references. For example:
"ActionDispatch::ShowExceptions" => ActionDispatch::ShowExceptions
```
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Specifically, the "loose upgrades" behaviour that allows us to obtain an
exclusive right to load things while other requests are in progress (but
waiting on the exclusive lock for themselves) prevents us from treating
load & unload interchangeably: new things appearing is fine, but they do
*not* expect previously-present constants to vanish.
We can still use loose upgrades for unloading -- once someone has
decided to unload, they don't really care if someone else gets there
first -- it just needs to be tracked separately.
|
| | |
|
|/
|
|
|
| |
We don't need to fully disable concurrent requests: just ensure that
loads are performed in isolation.
|
| |
|
|
|
|
| |
when true
|
| |
|
|
|
|
|
|
| |
Set `config.static_index` to serve a static directory index file not
named `index`. For example, to serve `main.html` instead of `index.html`
for directory requests, set `config.static_index` to `"main"`.
|
|
|
|
| |
This reverts commit a8bf12979e5fa15282b39c8cfa315e663f613539.
|
|
|
|
| |
Provided by sprockets-rails plugin
|
| |
|
| |
|
|
|
|
|
|
| |
Allow static asset serving from env variable (enhanced!)
Conflicts:
railties/CHANGELOG.md
|
| |
|
| |
|
|
|
|
|
|
| |
This is a more conservative approach to 2602a49. Also changed the comment to be
more inline with everything else in the file (describing what the config value
is doing and why). People should just read the docs for alternatives.
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2602a49a8600ab52f807599bbd5b1f9c0be4214f, reversing
changes made to 5d7c1057684c377bc2801c8851e99ff11ab23530.
The explicit default was introduced in 21f6d72, so apps created with Rails < 4
have the commented out version, which means that this change would break those
apps.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If code is not eager loaded constants are loaded on demand. Constant
autoloading is not thread-safe, so if eager loading is not enabled
multi-threading should not be allowed.
This showed up in certain Capybara scenarios: Most Capybara drivers
other than Rack::Test need a web server. In particular, drivers for
JavaScript support. Capybara launches WEBrick in its own thread for
those but that per se is fine, because the spec thread and the server
thread are coordinated.
Problem comes if the page being served in the spec makes Ajax calls.
Those may hit WEBrick in parallel, and since WEBrick is multi-threaded
and allow_concurrency? returns true in the test environment before
this patch, threads are spawned to serve those parallel requests. On
the other hand, since eager_load is false by default in the test
environment, constants are not preloaded.
So the suite is autoloading constants in a multi-threaded set. That's
a receipt for paracetamol. The symptom is random obscure errors whose
messages point somehow to constant autoloading.
As a consequence of this fix for allow_concurrency? WEBrick in
Capybara scenarios no longer runs in multi-threaded mode.
Fixes #15089.
|
|
|
|
|
|
| |
Since cc03675d30b58e28f585720dad14e947a57ff5b the error message became like
"Could not load database configuration. No such file -"
which doesn't really tell what's actually missing.
|
| |
|
|
|
|
|
|
|
| |
If we want to always default to :debug, let's just do that.
At which point the production.rb entry can become an "uncomment to
change" instead.
|
|
|
|
|
|
|
|
|
|
| |
Previously setting simple values to the config.x object resulted in the
following:
config.x.super_debugger = true
config.x.super_debugger #=> {}
Which was against the examples showed in the changelog/release notes.
|
|
|
|
|
|
|
|
|
| |
This reverts commit de4891344ccc074f6d5693f4fac6ad610584e336.
Conflicts:
railties/lib/rails/railtie/configuration.rb
It added regression. Will be back after the beta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Hashes can be assigned
2. We don't need a special level anymore
The method chain only works in the top level.
If users need a second level they need to assign a OrderedOptions to the
key:
config.resque.server = ActiveSupport::OrderedOptions.new
config.resque.server.url = "http://localhost"
config.resque.server.port = 3000
[Rafael Mendonça França + Carlos Antonio da Silva]
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds `config.action_mailer.preview_enabled`
This allows mail previewing to be enabled easily in non-development
environments such as staging. The default is set to true for development
so no changes should be required to existing Rails applications.
The mail preview path can still be configured using the existing
`config.action_mailer.preview_path` configuration option.
Adding this avoids devs from having to do stuff like:
https://gist.github.com/lengarvey/fa2c9bd6cdbeba96526a
Update actionmailer/CHANGELOG with new configuration.
Update configuring guide with new configuratation.
Add `config.action_mailer.preview_path` to configuring guide.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Database configuration was trying to load the first path that
config.paths['config/database'] was returning even if the path didn't
exist in the filesystem.
Because Rails::Paths::Path has the possibility to return more than 1
path (as an array), database_configuration should filter down the paths
to the existing one and then load the first one.
This would make it possible to move the database.yml file and add the
new path to paths['config/database'] and still load the configurations.
|
| |
|
|
|
|
| |
at config level
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit e0a521cfcd13e4d1f0ae8ab96004289e1c020f71.
Conflicts:
railties/CHANGELOG.md
We expect loggers to quack like stdlib logger. If log4r needs different
level= assignment, using a Logger-quacking wrapper is the way to do it.
Fixes #14114.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now if there is an error retrieving database configuration the intent of the error (what the code was trying to do while you got the error) could be more explicit.
Instead of this error:
```
Invalid DATABASE_URL: nil
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application/configuration.rb:98:in `database_configuration'
/Users/schneems/Documents/projects/rails/activerecord/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `instance_exec'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `each'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application.rb:339:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/engine/railties.rb:13:in `each'
```
I propose we issue this error:
```
Cannot load `Rails.application.database_configuration`:
Invalid DATABASE_URL: nil
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
/Users/schneems/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application/configuration.rb:98:in `database_configuration'
/Users/schneems/Documents/projects/rails/activerecord/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `instance_exec'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `each'
/Users/schneems/Documents/projects/rails/railties/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/application.rb:339:in `block in run_tasks_blocks'
/Users/schneems/Documents/projects/rails/railties/lib/rails/engine/railties.rb:13:in `each'
```
|
|
|
|
|
|
|
|
| |
This prevents Rails from assigning meaningless log levels to third
party loggers like log4r. If `Rails.logger` is not `kind_of?(::Logger)`
we simply assign the `config.log_level` as is.
This bug was introduced by #11665.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently Active Record can be configured via the environment variable `DATABASE_URL` or by manually injecting a hash of values which is what Rails does, reading in `database.yml` and setting Active Record appropriately. Active Record expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot rip out this functionality without deprecating. This presents a problem though when both config is set, and a `DATABASE_URL` is present. Currently the `DATABASE_URL` should "win" and none of the values in `database.yml` are used. This is somewhat unexpected to me if I were to set values such as `pool` in the `production:` group of `database.yml` they are ignored.
There are many ways that active record initiates a connection today:
- Stand Alone (without rails)
- `rake db:<tasks>`
- ActiveRecord.establish_connection
- With Rails
- `rake db:<tasks>`
- `rails <server> | <console>`
- `rails dbconsole`
We should make all of these behave exactly the same way. The best way to do this is to put all of this logic in one place so it is guaranteed to be used.
Here is my prosed matrix of how this behavior should work:
```
No database.yml
No DATABASE_URL
=> Error
```
```
database.yml present
No DATABASE_URL
=> Use database.yml configuration
```
```
No database.yml
DATABASE_URL present
=> use DATABASE_URL configuration
```
```
database.yml present
DATABASE_URL present
=> Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url`
sub key "wins". If other paramaters `adapter` or `database` are specified in YAML,
they are discarded as the `url` sub key "wins".
```
### Implementation
Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge all connection information before returning. This is achieved through a utility class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`.
To understand the exact behavior of this class, it is best to review the behavior in activerecord/test/cases/connection_adapters/connection_handler_test.rb though it should match the above proposal.
|