tweak logging for debugging purposes
This commit is contained in:
parent
bc8a864fc1
commit
e0e35eb97c
|
@ -6,7 +6,7 @@ object Config {
|
|||
val POSTGRES_PASSWORD = getEnv("PASSWORD", "example")
|
||||
val POSTGRES_HOST = getEnv("HOST", "localhost")
|
||||
val POSTGRES_PORT = getEnv("PORT", "5432")
|
||||
val UPLOAD_SECRET = getEnv("UPLOAD_SECRET", "").toByteArray()
|
||||
val UPLOAD_SECRET = getEnv("UPLOAD_SECRET", "")
|
||||
|
||||
private fun getEnv(key: String, default: String): String {
|
||||
return System.getenv("FROGMC_META_$key") ?: default
|
||||
|
|
|
@ -12,13 +12,13 @@ val authPlugin = createRouteScopedPlugin("auth") {
|
|||
val authorization = it.request.headers["Authorization"]
|
||||
if (authorization.isNullOrEmpty() || !MessageDigest.isEqual(
|
||||
authorization.toByteArray(),
|
||||
Config.UPLOAD_SECRET
|
||||
Config.UPLOAD_SECRET.toByteArray()
|
||||
)
|
||||
) {
|
||||
logger.info(
|
||||
"Authentication Failed: provided: ${
|
||||
authorization?.toByteArray().contentToString()
|
||||
}; expected: ${Config.UPLOAD_SECRET.contentToString()}"
|
||||
authorization
|
||||
}; expected: ${Config.UPLOAD_SECRET}"
|
||||
)
|
||||
it.respond(HttpStatusCode.Unauthorized)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue