Add mail-debug flag to rest-server

It has been added to the joex application, but it should be possible
to debug mail problems on both apps.
This commit is contained in:
Eike Kettner 2020-06-13 15:10:00 +02:00
parent fb8c97f4f0
commit 617487f5b3
4 changed files with 40 additions and 17 deletions

View File

@ -9,7 +9,7 @@ import docspell.store.queue.JobQueue
import docspell.store.usertask.UserTaskStore
import scala.concurrent.ExecutionContext
import emil.javamail.JavaMailEmil
import emil.javamail.{JavaMailEmil, Settings}
trait BackendApp[F[_]] {
@ -38,21 +38,23 @@ object BackendApp {
blocker: Blocker
): Resource[F, BackendApp[F]] =
for {
utStore <- UserTaskStore(store)
queue <- JobQueue(store)
loginImpl <- Login[F](store)
signupImpl <- OSignup[F](store)
collImpl <- OCollective[F](store)
sourceImpl <- OSource[F](store)
tagImpl <- OTag[F](store)
equipImpl <- OEquipment[F](store)
orgImpl <- OOrganization(store)
joexImpl <- OJoex.create(httpClientEc, store)
uploadImpl <- OUpload(store, queue, cfg.files, joexImpl)
nodeImpl <- ONode(store)
jobImpl <- OJob(store, joexImpl)
itemImpl <- OItem(store)
mailImpl <- OMail(store, JavaMailEmil(blocker))
utStore <- UserTaskStore(store)
queue <- JobQueue(store)
loginImpl <- Login[F](store)
signupImpl <- OSignup[F](store)
collImpl <- OCollective[F](store)
sourceImpl <- OSource[F](store)
tagImpl <- OTag[F](store)
equipImpl <- OEquipment[F](store)
orgImpl <- OOrganization(store)
joexImpl <- OJoex.create(httpClientEc, store)
uploadImpl <- OUpload(store, queue, cfg.files, joexImpl)
nodeImpl <- ONode(store)
jobImpl <- OJob(store, joexImpl)
itemImpl <- OItem(store)
javaEmil =
JavaMailEmil(blocker, Settings.defaultSettings.copy(debug = cfg.mailDebug))
mailImpl <- OMail(store, javaEmil)
userTaskImpl <- OUserTask(utStore, queue, joexImpl)
} yield new BackendApp[F] {
val login: Login[F] = loginImpl

View File

@ -4,7 +4,12 @@ import docspell.backend.signup.{Config => SignupConfig}
import docspell.common._
import docspell.store.JdbcConfig
case class Config(jdbc: JdbcConfig, signup: SignupConfig, files: Config.Files) {}
case class Config(
mailDebug: Boolean,
jdbc: JdbcConfig,
signup: SignupConfig,
files: Config.Files
) {}
object Config {

View File

@ -79,6 +79,11 @@ docspell.server {
# Configuration for the backend.
backend {
# Enable or disable debugging for e-mail related functionality. This
# applies to both sending and receiving mails. For security reasons
# logging is not very extensive on authentication failures. Setting
# this to true, results in a lot of data printed to stdout.
mail-debug = false
# The database connection.
#

View File

@ -41,6 +41,7 @@ let
session-valid = "5 minutes";
};
backend = {
mail-debug = false;
jdbc = {
url = "jdbc:h2:///tmp/docspell-demo.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE";
user = "sa";
@ -260,6 +261,16 @@ in {
backend = mkOption {
type = types.submodule({
options = {
mail-debug = mkOption {
type = types.bool;
default = defaults.backend.mail-debug;
description = ''
Enable or disable debugging for e-mail related functionality. This
applies to both sending and receiving mails. For security reasons
logging is not very extensive on authentication failures. Setting
this to true, results in a lot of data printed to stdout.
'';
};
jdbc = mkOption {
type = types.submodule ({
options = {