Ok,

I've got a start on this:
https://github.com/amiel/rails/compare/actionmailer-configuration.

So far, I've just got the ActionMailer::Base.configuration api as well as
deprecated support for the previous ActionMailer::Base.xxx_settings api.

Adding mail.yml at this point is trivial. Any thoughts on this before I
send in a pull-request?

Thanks,

-Amiel

http://carnesmedia.com


On Sun, May 5, 2013 at 6:04 PM, Amiel Martin <[email protected]> wrote:

> Hello,
>
> TL;DR: I'd like to move ActionMailer configuration to confg/mail.yml (just
> like config/database.yml). In order to make that possible (in a sane way),
> I would like to standardize the way ActiveRecord and ActionMailer are
> configured.
>
>
> As I was poking around to see how I would implement configuring
> ActionMailer with config/mail.yml, I was reminded how different the
> configuration APIs for ActiveRecord and ActionMailer are.
> My plan is to make the ActionMailer configuration api mirror the
> ActiveRecord configuration api. That is, the following should work:
>
> # current ActiveRecord configuration
> ActiveRecord::Base.configurations = {
>   development: {
>     adapter:    "postgresql",
>     host:       "localhost",
>     database:   "myapp_development",
>     username:   "rails",
>     password:   "sekret",
>   },
>   test: {
>     adapter:    "sqlite3",
>     database:   "db/test.sqlite3",
>     pool:       5,
>     timeout:    5000,
>   },
>   production: { } # ... etc
> }
>
> # proposed ActionMailer configuration
> ActionMailer::Base.configurations = {
>   development: {
>     adapter:    "sendmail",                     # renamed from
> delivery_method to match ActiveRecord
>     location:   "/usr/sbin/sendmail",
>     arguments:  "-i -t",
>   },
>   test: { adapter: "test" },                    # this would be the default
>   production: {
>     adapter:          "smtp",
>     host:             "smtp.sendgrid.net",      # renamed from address
>     port:             "587",
>     authentication:   :plain,
>     username:         ENV["SENDGRID_USERNAME"], # renamed from user_name
>     password:         ENV["SENDGRID_PASSWORD"],
>   },
> }
>
>
> I chose to make ActionMailer like ActiveRecord because I think that more
> people know ActiveRecord's configuration. However, if there is something
> about the way ActionMailer is configured that is desired, then
> ActiveRecord's configuration could also be changed (although it seems like
> it would be harder to change and deprecate ActiveRecord configuration).
>
> A few thoughts:
>
> * ActionMailer stores configuration for each delivery method
> (`smtp_settings`, `sendmail_settings`). I'm not sure why this is, but to me
> it makes more sense to flatten this configuration structure and split it up
> by environment.
> * This would be a major configuration change. If the change is accepted, I
> would write graceful deprecation and perhaps a migration helper.
> * I mentioned this idea to Aaron Patterson at Railsconf. He brought up the
> idea of having a more generic configuration storage mechanizm. While I'm
> not specifically working on that, I think this is a step in that direction.
>
> A few questions:
>
> * Any thoughts in general? Is this a good idea? Does anyone have major
> problems with this?
> * Does it make sense to rename configuration options such as renaming
> `address` to `host` in order to match the ActiveRecord configuration
> options more closely? Once again, I would make sure to not break existing
> configurations.
> * Is there anything about the current ActionMailer configuration api that
> is better than ActiveRecord's?
>
> I will start chipping away at this, and probably come back with more
> questions after a first pass.
> I would apreciate any initial feedback.
>
> Thank you for your time,
>
>
> -Amiel
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to