Skip to content

Commit 5514502

Browse files
committed
sender kun ut ordrefeilmelding hvis prod
1 parent e112862 commit 5514502

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/main/kotlin/no/nav/hjelpemidler/api/OrdreAPI.kt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import io.ktor.server.request.receive
66
import io.ktor.server.routing.Route
77
import io.ktor.server.routing.post
88
import mu.KotlinLogging
9+
import no.nav.hjelpemidler.Configuration
10+
import no.nav.hjelpemidler.Configuration.Profile
911
import no.nav.hjelpemidler.Context
1012
import no.nav.hjelpemidler.Ntfy
1113
import no.nav.hjelpemidler.Slack
12-
import no.nav.hjelpemidler.Configuration
1314
import java.time.LocalDateTime
1415
import java.util.UUID
1516

@@ -36,25 +37,27 @@ fun Route.ordreAPI(context: Context) {
3637
feilmelding.saksnummer,
3738
OrdrefeilmeldingMottatt(feilmelding = feilmelding)
3839
)
39-
Slack.post(
40-
text = "*${Configuration.profile}* - $feilmelding",
41-
channel = "#papaya-alerts"
42-
)
43-
Ntfy.publish(
44-
Ntfy.Notification(
45-
title = "Mottok ordrefeilmelding",
46-
message = "Status: ${feilmelding.status}",
47-
priority = Ntfy.Priority.HIGH,
48-
actions = setOf(
49-
Ntfy.Action(
50-
action = Ntfy.ActionType.VIEW,
51-
label = "Se detaljer i Slack",
52-
clear = true,
53-
url = "https://nav-it.slack.com/archives/C02LS2W05E1"
40+
if (Configuration.profile == Profile.PROD) {
41+
Slack.post(
42+
text = "*${Configuration.profile}* - $feilmelding",
43+
channel = "#papaya-alerts"
44+
)
45+
Ntfy.publish(
46+
Ntfy.Notification(
47+
title = "Mottok ordrefeilmelding",
48+
message = "Status: ${feilmelding.status}",
49+
priority = Ntfy.Priority.HIGH,
50+
actions = setOf(
51+
Ntfy.Action(
52+
action = Ntfy.ActionType.VIEW,
53+
label = "Se detaljer i Slack",
54+
clear = true,
55+
url = "https://nav-it.slack.com/archives/C02LS2W05E1"
56+
)
5457
)
5558
)
5659
)
57-
)
60+
}
5861
call.response.status(HttpStatusCode.OK)
5962
}
6063
}

0 commit comments

Comments
 (0)