-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
En FeatureToggleController for å kunne hente ut toggles for verifisering
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/no/nav/familie/ef/iverksett/featuretoggle/FeatureToggleController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) } | ||
} | ||
} |