Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Bruker app.name istd namespace for lokalt kjøring. (#46)
Browse files Browse the repository at this point in the history
* Bruker app.name istd namespace for lokalt kjøring.
* Oppdatert readme.
  • Loading branch information
mrsladek authored Jan 28, 2022
1 parent b5cbada commit b78f6c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Prioriteten på kilder er som følge:
- Miljø variabler (generelt alt som finnes i *System.getenv()*)
- System properties (generelt alt som finnes i *System.getProperties()*)

For kjøring utenfor kubernetes f.eks. fra IDE defaultes cluster navn til "local" og namespace til verdi satt
i System.getProperty("app.name");
Dvs at man kan nå properties under application.properties, application-lokal.properties og application-lokal-<app.name>.properties

Det er mulig å plugge inn en egen provider ved å implementere `PropertiesKonfigVerdiProvider` klassen.

Løsningen er CDI basert.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ private static String namespaceKonfig() {
var namespaceName = namespaceName();
if (namespaceName != null) {
return clusterKonfig() + "-" + namespaceName;
} else {
var appName = System.getProperty("app.name");
if (appName != null) {
return clusterKonfig() + "-" + appName;
}
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ test1.property=100
test2.property=2000
test3.property=10000000
test4.boolean=true
duration.property=PT1008H
duration.property=PT1008H

0 comments on commit b78f6c0

Please sign in to comment.