Merge branch 'main' into bildeopplastning-komponent
This commit is contained in:
commit
25069ecb19
5 changed files with 29 additions and 10 deletions
|
@ -13,9 +13,8 @@ fun main() {
|
||||||
|
|
||||||
class Application(private val db: Database) {
|
class Application(private val db: Database) {
|
||||||
fun startBlocking() {
|
fun startBlocking() {
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
configureRouting().start(wait = false)
|
configureRouting().start(wait = true)
|
||||||
Runtime.getRuntime().addShutdownHook(
|
Runtime.getRuntime().addShutdownHook(
|
||||||
Thread {
|
Thread {
|
||||||
db.dataSource.close()
|
db.dataSource.close()
|
||||||
|
|
|
@ -28,8 +28,8 @@ class Database(dbconfig: HikariConfig = dbconfig()) {
|
||||||
|
|
||||||
private fun dbconfig() = HikariConfig().apply {
|
private fun dbconfig() = HikariConfig().apply {
|
||||||
jdbcUrl = DB_URL
|
jdbcUrl = DB_URL
|
||||||
username = username
|
username = Environment.Database.username
|
||||||
password = password
|
password = Environment.Database.password
|
||||||
maximumPoolSize = 1
|
maximumPoolSize = 1
|
||||||
connectionTimeout = 30.seconds.toJavaDuration().toMillis()
|
connectionTimeout = 30.seconds.toJavaDuration().toMillis()
|
||||||
initializationFailTimeout = 1.minutes.toJavaDuration().toMillis()
|
initializationFailTimeout = 1.minutes.toJavaDuration().toMillis()
|
||||||
|
@ -37,8 +37,8 @@ private fun dbconfig() = HikariConfig().apply {
|
||||||
|
|
||||||
private fun migrateconfig() = HikariConfig().apply {
|
private fun migrateconfig() = HikariConfig().apply {
|
||||||
jdbcUrl = DB_URL
|
jdbcUrl = DB_URL
|
||||||
username = username
|
username = Environment.Database.username
|
||||||
password = password
|
password = Environment.Database.password
|
||||||
maximumPoolSize = 2
|
maximumPoolSize = 2
|
||||||
connectionTimeout = 30.seconds.toJavaDuration().toMillis()
|
connectionTimeout = 30.seconds.toJavaDuration().toMillis()
|
||||||
initializationFailTimeout = 1.minutes.toJavaDuration().toMillis()
|
initializationFailTimeout = 1.minutes.toJavaDuration().toMillis()
|
||||||
|
|
|
@ -8,6 +8,7 @@ import io.ktor.server.plugins.contentnegotiation.*
|
||||||
import io.ktor.serialization.kotlinx.json.*
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
import io.ktor.server.cio.*
|
import io.ktor.server.cio.*
|
||||||
import io.ktor.server.engine.*
|
import io.ktor.server.engine.*
|
||||||
|
import io.ktor.server.http.content.*
|
||||||
import io.ktor.server.plugins.cors.routing.*
|
import io.ktor.server.plugins.cors.routing.*
|
||||||
import io.ktor.server.request.*
|
import io.ktor.server.request.*
|
||||||
import no.nav.helse.sprik.Test
|
import no.nav.helse.sprik.Test
|
||||||
|
@ -25,9 +26,22 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin
|
||||||
json()
|
json()
|
||||||
}
|
}
|
||||||
routing {
|
routing {
|
||||||
|
singlePageApplication{
|
||||||
|
filesPath = "frontend/.next/server/pages/"
|
||||||
|
defaultPage = "index.html"
|
||||||
|
ignoreFiles {
|
||||||
|
it.endsWith(".txt")
|
||||||
|
}
|
||||||
|
}
|
||||||
get("/") {
|
get("/") {
|
||||||
call.respondText("Hello World!")
|
call.respondText("Hello World!")
|
||||||
}
|
}
|
||||||
|
get("/isalive"){
|
||||||
|
call.respondText("ALIVE")
|
||||||
|
}
|
||||||
|
get("/isready"){
|
||||||
|
call.respondText("READY")
|
||||||
|
}
|
||||||
post("/test") {
|
post("/test") {
|
||||||
val test = call.receive<Test>()
|
val test = call.receive<Test>()
|
||||||
call.respond(status = HttpStatusCode.Created, message = test)
|
call.respond(status = HttpStatusCode.Created, message = test)
|
||||||
|
@ -37,9 +51,11 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin
|
||||||
println(test)
|
println(test)
|
||||||
call.respond(status = HttpStatusCode.Created, message = test)
|
call.respond(status = HttpStatusCode.Created, message = test)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
connector {
|
||||||
|
port = 8080
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
output: 'standalone',
|
output: 'export',
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = nextConfig
|
module.exports = nextConfig
|
||||||
|
|
8
nais.yml
8
nais.yml
|
@ -8,6 +8,12 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
image: {{ image }}
|
image: {{ image }}
|
||||||
port: 8080
|
port: 8080
|
||||||
|
liveness:
|
||||||
|
path: isalive
|
||||||
|
initialDelay: 5
|
||||||
|
readiness:
|
||||||
|
path: isready
|
||||||
|
initialDelay: 5
|
||||||
replicas:
|
replicas:
|
||||||
min: 1
|
min: 1
|
||||||
max: 2
|
max: 2
|
||||||
|
@ -18,8 +24,6 @@ spec:
|
||||||
databases:
|
databases:
|
||||||
- name: helse-sprik
|
- name: helse-sprik
|
||||||
envVarPrefix: DATABASE
|
envVarPrefix: DATABASE
|
||||||
users:
|
|
||||||
- name: helse-sprik
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
|
|
Reference in a new issue