Skip to content

Commit f5fc094

Browse files
committed
Upgrade Ktor from 3.0.0-beta-1 to 3.0.0-beta-2
1 parent 81105bf commit f5fc094

File tree

11 files changed

+11
-21
lines changed

11 files changed

+11
-21
lines changed

Diff for: build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ testing {
7777
// for some reason, transitive dependencies aren't included in the test classpath
7878
implementation(projects.api)
7979
implementation(tests.junit.api)
80-
implementation(tests.ktor.server.tests)
80+
implementation(tests.ktor.server.testHost)
8181
implementation(tests.mockk)
8282
implementation(tests.assertj.core)
8383
implementation(tests.json)

Diff for: integrations/moodle/src/main/kotlin/me/snoty/integration/moodle/calendar/MoodleCalendars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MoodleCalendarBuilder(entityStateService: EntityStateService) : ICalBuilde
2121
}
2222
}
2323

24-
fun Route.iCalRoutes(nodeService: NodeService, calendarService: CalendarService, entityStateService: EntityStateService) {
24+
fun Routing.iCalRoutes(nodeService: NodeService, calendarService: CalendarService, entityStateService: EntityStateService) {
2525
calendarRoutes(
2626
nodeService,
2727
calendarService,

Diff for: integrations/utils/calendar/src/main/kotlin/me/snoty/integration/utils/calendar/ICalRoutes.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import java.nio.charset.StandardCharsets
2020
@Serializable
2121
data class ICalCreateRequest(val nodeId: NodeId)
2222

23-
fun Route.calendarRoutes(
23+
fun Routing.calendarRoutes(
2424
nodeService: NodeService,
2525
calendarService: CalendarService,
2626
calendarType: String,

Diff for: integrations/webuntis/src/main/kotlin/me/snoty/integration/untis/calendar/WebUntisCalendars.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WebUntisCalendarBuilder(entityStateService: EntityStateService) : ICalBuil
2222
}
2323
}
2424

25-
fun Route.iCalRoutes(nodeService: NodeService, calendarService: CalendarService, entityStateService: EntityStateService) {
25+
fun Routing.iCalRoutes(nodeService: NodeService, calendarService: CalendarService, entityStateService: EntityStateService) {
2626
calendarRoutes(
2727
nodeService,
2828
calendarService,

Diff for: settings.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fun String.kebabCaseToCamelCase(): String {
1212

1313
dependencyResolutionManagement {
1414
versionCatalogs {
15-
val ktorVersion = "3.0.0-beta-1"
15+
val ktorVersion = "3.0.0-beta-2"
1616

1717
fun buildKtorArtifactAlias(prefix: String? = null, artifact: String, hierarchy: Boolean): String {
1818
var result: String = prefix ?: ""
@@ -171,7 +171,7 @@ dependencyResolutionManagement {
171171
}
172172

173173
create("tests") {
174-
ktorServerPlugin("tests", prefix = "ktor")
174+
ktorServerPlugin("test-host", prefix = "ktor")
175175
library("mockk", "io.mockk", "mockk")
176176
.version("1.13.10")
177177
library("assertj-core", "org.assertj", "assertj-core")

Diff for: src/main/kotlin/me/snoty/backend/Application.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ fun main() = runBlocking {
133133
register(CodecRegistry::class, codecRegistry)
134134
}
135135

136-
KtorServer(config, featureFlags, buildInfo, meterRegistry, services, nodeJson)
136+
KtorServer(config, buildInfo, meterRegistry, services, nodeJson)
137137
.start(wait = true)
138138
}

Diff for: src/main/kotlin/me/snoty/backend/server/KtorServer.kt

-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package me.snoty.backend.server
22

3-
import ch.qos.logback.classic.Level
4-
import ch.qos.logback.classic.LoggerContext
53
import io.github.oshai.kotlinlogging.KotlinLogging
64
import io.ktor.server.application.*
75
import io.ktor.server.engine.*
@@ -10,14 +8,11 @@ import io.micrometer.core.instrument.MeterRegistry
108
import kotlinx.serialization.json.Json
119
import me.snoty.backend.build.BuildInfo
1210
import me.snoty.backend.config.Config
13-
import me.snoty.backend.featureflags.FeatureFlags
1411
import me.snoty.backend.injection.ServicesContainer
1512
import me.snoty.backend.server.plugins.*
16-
import org.slf4j.LoggerFactory
1713

1814
class KtorServer(
1915
private val config: Config,
20-
private val featureFlags: FeatureFlags,
2116
private val buildInfo: BuildInfo,
2217
private val metricsRegistry: MeterRegistry,
2318
private val servicesContainer: ServicesContainer,
@@ -38,12 +33,7 @@ class KtorServer(
3833
port = config.port.toInt(),
3934
host = "0.0.0.0",
4035
module = {
41-
val loggerFactory = LoggerFactory.getILoggerFactory() as LoggerContext
42-
val ktorRootLogger = loggerFactory.exists("io.ktor.server")
43-
// workaround for https://youtrack.jetbrains.com/issue/KTOR-7193/Tracing-allow-changing-log-level-at-runtime
44-
ktorRootLogger.level = Level.TRACE
4536
module()
46-
ktorRootLogger.level = Level.convertAnSLF4JLevel(featureFlags.get(featureFlags.logLevel_http_server))
4737
},
4838
watchPaths = listOf("classes", "resources")
4939
).start(wait = wait)

Diff for: src/main/kotlin/me/snoty/backend/server/plugins/Monitoring.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import io.ktor.server.engine.*
66
import io.ktor.server.metrics.micrometer.*
77
import io.ktor.server.netty.*
88
import io.ktor.server.plugins.callid.*
9-
import io.ktor.server.plugins.callloging.*
9+
import io.ktor.server.plugins.calllogging.*
1010
import io.ktor.server.request.*
1111
import io.ktor.server.response.*
1212
import io.ktor.server.routing.*

Diff for: src/main/kotlin/me/snoty/backend/server/resources/AboutResource.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ data class AboutResponse(
1515
val buildInfo: BuildInfo
1616
)
1717

18-
fun Route.aboutResource(buildInfo: BuildInfo) {
18+
fun Routing.aboutResource(buildInfo: BuildInfo) {
1919
val hostname = InetAddress.getLocalHost().hostName
2020
get("/info") {
2121
call.respond(AboutResponse(

Diff for: src/main/kotlin/me/snoty/backend/server/resources/wiring/FlowResource.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import me.snoty.integration.common.wiring.node.NodeRegistry
1818
import me.snoty.integration.common.model.NodePosition
1919

2020
context(ServicesContainer)
21-
fun Route.flowResource() {
21+
fun Routing.flowResource() {
2222
val nodeRegistry = get<NodeRegistry>()
2323
val nodeService = get<NodeService>()
2424
val flowService = get<FlowService>()

Diff for: src/main/kotlin/me/snoty/backend/server/resources/wiring/NodeResource.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import me.snoty.integration.common.wiring.node.NodeSettings
2828

2929
context(ServicesContainer)
3030
@OptIn(InternalSerializationApi::class)
31-
fun Route.nodeResource(json: Json) {
31+
fun Routing.nodeResource(json: Json) {
3232
val nodeRegistry = get<NodeRegistry>()
3333
val nodeService = get<NodeService>()
3434
suspend fun deserializeSettings(call: ApplicationCall, descriptor: NodeDescriptor, settingsJson: JsonElement): NodeSettings? {

0 commit comments

Comments
 (0)