Skip to content

Commit

Permalink
En FeatureToggleController for å kunne hente ut toggles for verifisering
Browse files Browse the repository at this point in the history
  • Loading branch information
throndi committed Sep 13, 2023
1 parent 96267d7 commit ecbe375
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package no.nav.familie.ef.iverksett.featuretoggle

import no.nav.security.token.support.core.api.Unprotected
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

enum class Toggle(val toggleId: String) {
IVERKSETT_SIMULERINGSKONTROLL("familie.ef.iverksett.simuleringskontroll", ),
IVERKSETT_STOPP_IVERKSETTING("familie.ef.iverksett.stopp-iverksetting");
}

@RestController
@RequestMapping(path = ["/api/featuretoggle"], produces = [MediaType.APPLICATION_JSON_VALUE])
@Unprotected
class FeatureToggleController(val featureToggleService: FeatureToggleService) {
private val funksjonsbrytere = setOf(
Toggle.IVERKSETT_STOPP_IVERKSETTING,
Toggle.IVERKSETT_SIMULERINGSKONTROLL
)

@GetMapping
fun sjekkAlle(): Map<String, Boolean> {
return funksjonsbrytere.associate { it.toggleId to featureToggleService.isEnabled(it.toggleId) }
}
}

0 comments on commit ecbe375

Please sign in to comment.