diff --git a/src/main/kotlin/fr/dcproject/application/Application.kt b/src/main/kotlin/fr/dcproject/application/Application.kt index b2ebd90..cc7b126 100644 --- a/src/main/kotlin/fr/dcproject/application/Application.kt +++ b/src/main/kotlin/fr/dcproject/application/Application.kt @@ -173,7 +173,6 @@ fun Application.module(env: Env = PROD) { } install(StatusPages) { - // TODO move to postgresJson lib exception { e -> val parent = e.cause?.cause if (parent is GenericDatabaseException) { @@ -199,8 +198,11 @@ fun Application.module(env: Env = PROD) { method(HttpMethod.Put) method(HttpMethod.Delete) header(HttpHeaders.Authorization) - anyHost() - // host("localhost:4200", schemes = listOf("http", "https")) + if (env == PROD) { + host("localhost:4200", schemes = listOf("http", "https")) + } else { + anyHost() + } allowCredentials = true allowSameOrigin = true maxAge = Duration.ofDays(1) diff --git a/src/main/kotlin/fr/dcproject/component/notification/NotificationsPush.kt b/src/main/kotlin/fr/dcproject/component/notification/NotificationsPush.kt index 568639c..7ae0892 100644 --- a/src/main/kotlin/fr/dcproject/component/notification/NotificationsPush.kt +++ b/src/main/kotlin/fr/dcproject/component/notification/NotificationsPush.kt @@ -37,8 +37,8 @@ class NotificationsPush private constructor( ) { class Builder(val redisClient: RedisClient) { private val redisConnection = redisClient.connect() ?: error("Unable to connect to redis") - private val redisConnectionPubSub = redisClient.connectPubSub() ?: error("Unable to connect to redis") - private val redis: RedisAsyncCommands = redisConnection.async() ?: error("Unable to connect to redis") + private val redisConnectionPubSub = redisClient.connectPubSub() ?: error("Unable to connect to redis PubSub") + private val redis: RedisAsyncCommands = redisConnection.async() ?: error("Unable to connect to redis Async") fun build( citizen: CitizenI, @@ -93,7 +93,7 @@ class NotificationsPush private constructor( addListener(listener) /* 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") } }