Merge pull request #227 from usbharu/feature/debug-json

feat: デバッグ用のトレースをオン・オフできるように
This commit is contained in:
usbharu 2023-12-21 12:07:10 +09:00 committed by GitHub
commit a3aaeae8c8
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.SignatureHeaderParser
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
@Service
@ -34,6 +35,9 @@ class InboxJobProcessor(
private val transaction: Transaction
) : JobProcessor<InboxJobParam, InboxJob> {
@Value("\${hideout.debug.trace-inbox:false}")
private var traceJson: Boolean = false
private suspend fun verifyHttpSignature(
httpRequest: HttpRequest,
signature: Signature,
@ -85,7 +89,10 @@ class InboxJobProcessor(
val jsonNode = objectMapper.readTree(param.json)
logger.info("START Process inbox. type: {}", param.type)
logger.trace("type: {}\njson: \n{}", param.type, jsonNode.toPrettyString())
if (traceJson) {
logger.trace("type: {}\njson: \n{}", param.type, jsonNode.toPrettyString())
}
val map = objectMapper.readValue<Map<String, List<String>>>(param.headers)