feat: デバッグ用のトレースをオン・オフできるように

This commit is contained in:
usbharu 2023-12-21 12:06:51 +09:00
parent a36d937239
commit 0d7dfc6d27
1 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import dev.usbharu.httpsignature.verify.HttpSignatureVerifier
import dev.usbharu.httpsignature.verify.Signature import dev.usbharu.httpsignature.verify.Signature
import dev.usbharu.httpsignature.verify.SignatureHeaderParser import dev.usbharu.httpsignature.verify.SignatureHeaderParser
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
@Service @Service
@ -34,6 +35,9 @@ class InboxJobProcessor(
private val transaction: Transaction private val transaction: Transaction
) : JobProcessor<InboxJobParam, InboxJob> { ) : JobProcessor<InboxJobParam, InboxJob> {
@Value("\${hideout.debug.trace-inbox:false}")
private var traceJson: Boolean = false
private suspend fun verifyHttpSignature( private suspend fun verifyHttpSignature(
httpRequest: HttpRequest, httpRequest: HttpRequest,
signature: Signature, signature: Signature,
@ -85,7 +89,10 @@ class InboxJobProcessor(
val jsonNode = objectMapper.readTree(param.json) val jsonNode = objectMapper.readTree(param.json)
logger.info("START Process inbox. type: {}", param.type) logger.info("START Process inbox. type: {}", param.type)
if (traceJson) {
logger.trace("type: {}\njson: \n{}", param.type, jsonNode.toPrettyString()) logger.trace("type: {}\njson: \n{}", param.type, jsonNode.toPrettyString())
}
val map = objectMapper.readValue<Map<String, List<String>>>(param.headers) val map = objectMapper.readValue<Map<String, List<String>>>(param.headers)