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_PASSWORD = getEnv("PASSWORD", "example")
|
||||||
val POSTGRES_HOST = getEnv("HOST", "localhost")
|
val POSTGRES_HOST = getEnv("HOST", "localhost")
|
||||||
val POSTGRES_PORT = getEnv("PORT", "5432")
|
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 {
|
private fun getEnv(key: String, default: String): String {
|
||||||
return System.getenv("FROGMC_META_$key") ?: default
|
return System.getenv("FROGMC_META_$key") ?: default
|
||||||
|
|
|
@ -12,13 +12,13 @@ val authPlugin = createRouteScopedPlugin("auth") {
|
||||||
val authorization = it.request.headers["Authorization"]
|
val authorization = it.request.headers["Authorization"]
|
||||||
if (authorization.isNullOrEmpty() || !MessageDigest.isEqual(
|
if (authorization.isNullOrEmpty() || !MessageDigest.isEqual(
|
||||||
authorization.toByteArray(),
|
authorization.toByteArray(),
|
||||||
Config.UPLOAD_SECRET
|
Config.UPLOAD_SECRET.toByteArray()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Authentication Failed: provided: ${
|
"Authentication Failed: provided: ${
|
||||||
authorization?.toByteArray().contentToString()
|
authorization
|
||||||
}; expected: ${Config.UPLOAD_SECRET.contentToString()}"
|
}; expected: ${Config.UPLOAD_SECRET}"
|
||||||
)
|
)
|
||||||
it.respond(HttpStatusCode.Unauthorized)
|
it.respond(HttpStatusCode.Unauthorized)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue