Skip to content

Commit

Permalink
Add startup logging for session handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Nov 29, 2024
1 parent f0700bd commit 16fe2af
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import com.faforever.icebreaker.config.FafProperties
import com.faforever.icebreaker.service.Server
import com.faforever.icebreaker.service.Session
import com.faforever.icebreaker.service.SessionHandler
import jakarta.inject.Singleton
import jakarta.annotation.PostConstruct
import jakarta.enterprise.context.ApplicationScoped
import org.slf4j.Logger
import org.slf4j.LoggerFactory

@Singleton
private val LOG: Logger = LoggerFactory.getLogger(CloudflareSessionHandler::class.java)

@ApplicationScoped
class CloudflareSessionHandler(
cloudflareProperties: CloudflareProperties,
val fafProperties: FafProperties,
Expand All @@ -19,6 +24,11 @@ class CloudflareSessionHandler(
override val active = cloudflareProperties.enabled()
private val turnEnabled = cloudflareProperties.turnEnabled()

@PostConstruct
fun init() {
LOG.info("CloudflareSessionHandler active: $active, turnEnabled: $turnEnabled")
}

override fun createSession(id: String) {
// Cloudflare has no session handling, we use global access
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,29 @@ import com.faforever.icebreaker.persistence.CoturnServerRepository
import com.faforever.icebreaker.service.Server
import com.faforever.icebreaker.service.Session
import com.faforever.icebreaker.service.SessionHandler
import jakarta.inject.Singleton
import jakarta.annotation.PostConstruct
import jakarta.enterprise.context.ApplicationScoped
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.util.Base64
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec

@Singleton
private val LOG: Logger = LoggerFactory.getLogger(CoturnSessionHandler::class.java)

@ApplicationScoped
class CoturnSessionHandler(
val fafProperties: FafProperties,
val coturnServerRepository: CoturnServerRepository,
) : SessionHandler {
// if you don't want to use it, leave the SQL table empty
override val active = true

@PostConstruct
fun init() {
LOG.info("CoturnSessionHandler active: $active")
}

override fun createSession(id: String) {
// Coturn has no session handling, we use global access
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import com.faforever.icebreaker.config.FafProperties
import com.faforever.icebreaker.service.Server
import com.faforever.icebreaker.service.Session
import com.faforever.icebreaker.service.SessionHandler
import jakarta.inject.Singleton
import jakarta.annotation.PostConstruct
import jakarta.enterprise.context.ApplicationScoped
import org.slf4j.Logger
import org.slf4j.LoggerFactory

private val LOG: Logger = LoggerFactory.getLogger(XirsysSessionHandler::class.java)

@Singleton
@ApplicationScoped
class XirsysSessionHandler(
xirsysProperties: XirsysProperties,
private val fafProperties: FafProperties,
Expand All @@ -23,6 +24,11 @@ class XirsysSessionHandler(
override val active = xirsysProperties.enabled()
private val turnEnabled = xirsysProperties.turnEnabled()

@PostConstruct
fun init() {
LOG.info("XirsysSessionHandler active: $active, turnEnabled: $turnEnabled")
}

override fun createSession(id: String) {
LOG.debug("Creating session id $id")
xirsysApiAdapter.createChannel(id)
Expand Down

0 comments on commit 16fe2af

Please sign in to comment.