Big refactoring #77
@@ -173,7 +173,6 @@ fun Application.module(env: Env = PROD) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install(StatusPages) {
|
install(StatusPages) {
|
||||||
// TODO move to postgresJson lib
|
|
||||||
exception<CompletionException> { e ->
|
exception<CompletionException> { e ->
|
||||||
val parent = e.cause?.cause
|
val parent = e.cause?.cause
|
||||||
if (parent is GenericDatabaseException) {
|
if (parent is GenericDatabaseException) {
|
||||||
@@ -199,8 +198,11 @@ fun Application.module(env: Env = PROD) {
|
|||||||
method(HttpMethod.Put)
|
method(HttpMethod.Put)
|
||||||
method(HttpMethod.Delete)
|
method(HttpMethod.Delete)
|
||||||
header(HttpHeaders.Authorization)
|
header(HttpHeaders.Authorization)
|
||||||
|
if (env == PROD) {
|
||||||
|
host("localhost:4200", schemes = listOf("http", "https"))
|
||||||
|
} else {
|
||||||
anyHost()
|
anyHost()
|
||||||
// host("localhost:4200", schemes = listOf("http", "https"))
|
}
|
||||||
allowCredentials = true
|
allowCredentials = true
|
||||||
allowSameOrigin = true
|
allowSameOrigin = true
|
||||||
maxAge = Duration.ofDays(1)
|
maxAge = Duration.ofDays(1)
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class NotificationsPush private constructor(
|
|||||||
) {
|
) {
|
||||||
class Builder(val redisClient: RedisClient) {
|
class Builder(val redisClient: RedisClient) {
|
||||||
private val redisConnection = redisClient.connect() ?: error("Unable to connect to redis")
|
private val redisConnection = redisClient.connect() ?: error("Unable to connect to redis")
|
||||||
private val redisConnectionPubSub = redisClient.connectPubSub() ?: error("Unable to connect to redis")
|
private val redisConnectionPubSub = redisClient.connectPubSub() ?: error("Unable to connect to redis PubSub")
|
||||||
private val redis: RedisAsyncCommands<String, String> = redisConnection.async() ?: error("Unable to connect to redis")
|
private val redis: RedisAsyncCommands<String, String> = redisConnection.async() ?: error("Unable to connect to redis Async")
|
||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
citizen: CitizenI,
|
citizen: CitizenI,
|
||||||
@@ -93,7 +93,7 @@ class NotificationsPush private constructor(
|
|||||||
addListener(listener)
|
addListener(listener)
|
||||||
|
|
||||||
/* Register to the events */
|
/* Register to the events */
|
||||||
async()?.psubscribe("__key*__:$key") ?: error("Unable to connect to redis")
|
async()?.psubscribe("__key*__:$key") ?: error("Unable to subscribe to redis events")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user