Mailer: Consider merging System.properties into Props
> Rather than using System.getProperties should Mailer use
> net.liftweb.util.Props? It seems a little inconsistent as is.
> -harryh
This makes sense for me too. In our live lift app we have code in Boot to just copy props (that we happen to have named the same as the System mail properties) to System.properties:
...and that seems a little messy, although not particularly painful.
I'd expect any explicitly set System.properties (-D flags) to take precedence over any in Props, but that's maybe just my taste (and almost the exact opposite of the code we've written!).
> net.liftweb.util.Props? It seems a little inconsistent as is.
> -harryh
This makes sense for me too. In our live lift app we have code in Boot to just copy props (that we happen to have named the same as the System mail properties) to System.properties:
// props starting "mail.smtp." just need to be copied to System.properties:
Props.props.filter(_._1 startsWith "mail.smtp").foreach( entry => System.setProperty(entry._1, entry._2) )
// Set up SMTP auth if a username and password is supplied
Mailer.authenticator = (Props.get("mail.user"), Props.get("mail.password")) match {
case (Full(u), Full(p)) => Full(new javax.mail.Authenticator {
override def getPasswordAuthentication = new javax.mail.PasswordAuthentication(u,p)
})
case _ => Empty
}
...and that seems a little messy, although not particularly painful.
I'd expect any explicitly set System.properties (-D flags) to take precedence over any in Props, but that's maybe just my taste (and almost the exact opposite of the code we've written!).
Leave a comment
on 2010-02-06 14:48 *
By github.importer
Imported from GitHub: http://github.com/dpp/liftweb/issues/73/find