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

View File

@ -4,7 +4,12 @@ import docspell.backend.signup.{Config => SignupConfig}
import docspell.common._ import docspell.common._
import docspell.store.JdbcConfig 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 { object Config {

View File

@ -79,6 +79,11 @@ docspell.server {
# Configuration for the backend. # Configuration for the backend.
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. # The database connection.
# #

View File

@ -41,6 +41,7 @@ let
session-valid = "5 minutes"; session-valid = "5 minutes";
}; };
backend = { backend = {
mail-debug = false;
jdbc = { jdbc = {
url = "jdbc:h2:///tmp/docspell-demo.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE"; url = "jdbc:h2:///tmp/docspell-demo.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE";
user = "sa"; user = "sa";
@ -260,6 +261,16 @@ in {
backend = mkOption { backend = mkOption {
type = types.submodule({ type = types.submodule({
options = { 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 { jdbc = mkOption {
type = types.submodule ({ type = types.submodule ({
options = { options = {