Skip to content

Commit adab474

Browse files
authored
TFP-5748: Legger til FPKALKULUS i FpApplications (#1350)
1 parent f7865ea commit adab474

File tree

1 file changed

+20
-18
lines changed
  • integrasjon/rest-klient/src/main/java/no/nav/vedtak/felles/integrasjon/rest

1 file changed

+20
-18
lines changed

integrasjon/rest-klient/src/main/java/no/nav/vedtak/felles/integrasjon/rest/FpApplication.java

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package no.nav.vedtak.felles.integrasjon.rest;
22

3-
import java.util.Map;
43
import java.util.Optional;
54
import java.util.Set;
65

@@ -11,6 +10,7 @@
1110
public enum FpApplication {
1211
FPSAK,
1312
FPABAKUS,
13+
FPKALKULUS,
1414
FPFORMIDLING,
1515
FPRISK,
1616
FPABONNENT,
@@ -28,22 +28,24 @@ public enum FpApplication {
2828
// FpApplication brukes til å kalle apps i namespace foreldrepenger - ikke riktig å bruke ENV/namespace
2929
private static final Namespace FORELDREPENGER = Namespace.foreldrepenger();
3030

31-
/*
32-
* Utelatt fpabonnent:8065
33-
*/
34-
private static final Map<FpApplication, Integer> LOCAL_PORTS = Map.ofEntries(
35-
Map.entry(FpApplication.FPSAK, 8080),
36-
Map.entry(FpApplication.FPABAKUS, 8015),
37-
Map.entry(FpApplication.FPFORMIDLING, 8010),
38-
Map.entry(FpApplication.FPRISK, 8075),
39-
Map.entry(FpApplication.FPOPPDRAG, 8070),
40-
Map.entry(FpApplication.FPTILBAKE, 8030),
41-
Map.entry(FpApplication.FPFORDEL, 8090),
42-
Map.entry(FpApplication.FPDOKGEN, 8291),
43-
Map.entry(FpApplication.FPWSPROXY, 8292),
44-
Map.entry(FpApplication.FPLOS, 8071),
45-
Map.entry(FpApplication.FPOVERSIKT, 8889)
46-
);
31+
private static Integer lokalPort(FpApplication application) {
32+
return switch (application) {
33+
case FPSAK -> 8080;
34+
case FPABAKUS -> 8015;
35+
case FPKALKULUS -> 8016;
36+
case FPFORMIDLING -> 8010;
37+
case FPRISK -> 8075;
38+
case FPABONNENT -> 8065;
39+
case FPFORDEL -> 8090;
40+
case FPLOS -> 8071;
41+
case FPOPPDRAG -> 8070;
42+
case FPTILBAKE -> 8030;
43+
case FPDOKGEN -> 8291;
44+
case FPWSPROXY -> 8292;
45+
case FPOVERSIKT -> 8889;
46+
case NONFP -> throw new IllegalArgumentException("Utviklerfeil: angitt app er ikke i fp-familien");
47+
};
48+
}
4749

4850
private static final Set<FpApplication> GCP_APPS = Set.of(FPOVERSIKT);
4951

@@ -93,7 +95,7 @@ private static String urlForCommunicationBetweenDifferentClusters(FpApplication
9395

9496
private static String urlForLocal(FpApplication application, Environment currentEnvironment, String appname) {
9597
return Optional.ofNullable(currentEnvironment.getProperty(application.name().toLowerCase() + ".override.url"))
96-
.orElseGet(() -> String.format("http://localhost:%s/%s", LOCAL_PORTS.get(application), appname));
98+
.orElseGet(() -> String.format("http://localhost:%s/%s", lokalPort(application), appname));
9799
}
98100

99101
static String scopesFor(FpApplication application, Environment currentEnvironment) {

0 commit comments

Comments
 (0)