Skip to content

Commit

Permalink
TFP-5748: Legger til FPKALKULUS i FpApplications (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
espenwaaga authored Mar 20, 2024
1 parent f7865ea commit adab474
Showing 1 changed file with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package no.nav.vedtak.felles.integrasjon.rest;

import java.util.Map;
import java.util.Optional;
import java.util.Set;

Expand All @@ -11,6 +10,7 @@
public enum FpApplication {
FPSAK,
FPABAKUS,
FPKALKULUS,
FPFORMIDLING,
FPRISK,
FPABONNENT,
Expand All @@ -28,22 +28,24 @@ public enum FpApplication {
// FpApplication brukes til å kalle apps i namespace foreldrepenger - ikke riktig å bruke ENV/namespace
private static final Namespace FORELDREPENGER = Namespace.foreldrepenger();

/*
* Utelatt fpabonnent:8065
*/
private static final Map<FpApplication, Integer> LOCAL_PORTS = Map.ofEntries(
Map.entry(FpApplication.FPSAK, 8080),
Map.entry(FpApplication.FPABAKUS, 8015),
Map.entry(FpApplication.FPFORMIDLING, 8010),
Map.entry(FpApplication.FPRISK, 8075),
Map.entry(FpApplication.FPOPPDRAG, 8070),
Map.entry(FpApplication.FPTILBAKE, 8030),
Map.entry(FpApplication.FPFORDEL, 8090),
Map.entry(FpApplication.FPDOKGEN, 8291),
Map.entry(FpApplication.FPWSPROXY, 8292),
Map.entry(FpApplication.FPLOS, 8071),
Map.entry(FpApplication.FPOVERSIKT, 8889)
);
private static Integer lokalPort(FpApplication application) {
return switch (application) {
case FPSAK -> 8080;
case FPABAKUS -> 8015;
case FPKALKULUS -> 8016;
case FPFORMIDLING -> 8010;
case FPRISK -> 8075;
case FPABONNENT -> 8065;
case FPFORDEL -> 8090;
case FPLOS -> 8071;
case FPOPPDRAG -> 8070;
case FPTILBAKE -> 8030;
case FPDOKGEN -> 8291;
case FPWSPROXY -> 8292;
case FPOVERSIKT -> 8889;
case NONFP -> throw new IllegalArgumentException("Utviklerfeil: angitt app er ikke i fp-familien");
};
}

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

Expand Down Expand Up @@ -93,7 +95,7 @@ private static String urlForCommunicationBetweenDifferentClusters(FpApplication

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

static String scopesFor(FpApplication application, Environment currentEnvironment) {
Expand Down

0 comments on commit adab474

Please sign in to comment.