Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFP-5748: Legger til FPKALKULUS i FpApplications #1350

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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