File tree Expand file tree Collapse file tree 7 files changed +32
-10
lines changed
kotlin/no/ssb/metadata/vardef/integrations Expand file tree Collapse file tree 7 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ jobs:
1111 runs-on : ubuntu-latest
1212 timeout-minutes : 20
1313 steps :
14-
1514 - name : Check out code
1615 uses : actions/checkout@v6
1716 with :
1817 fetch-depth : 0
1918
19+ - name : Set up Docker
20+ uses : docker/setup-docker-action@v4
21+ with :
22+ version : v28.0.0
23+ set-host : ' true'
24+
2025 - name : Set up Java
2126 uses : actions/setup-java@v5
2227 with :
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ Framework: Micronaut
1616
1717Data store: MongoDB Atlas
1818
19+ ## Docker
20+
21+ :warning : For running tests Docker versions before v29 must be used due to incompatibility in the API version used by Testcontainers. This will be resolved once we upgrade to Micronaut Test Resources v3+.
22+
1923## Contributing
2024
2125See the [ contributing guide] ( ./CONTRIBUTING.md ) .
Original file line number Diff line number Diff line change @@ -216,3 +216,16 @@ tasks.register<Copy>("copyPublicOpenApiSpec") {
216216 from(layout.buildDirectory.file(" generated/ksp/main/resources/META-INF/swagger/variable-definitions-public.yml" ))
217217 into(layout.projectDirectory.dir(" openapi" ))
218218}
219+
220+ val setVersionProperty by tasks.register<ProcessResources >(" setVersionProperty" ) {
221+ from(layout.projectDirectory.dir(" src/main/resources" )) {
222+ include(" **/application.yml" )
223+ filter {
224+ it.replace(" {{APP_VERSION}}" , version.toString())
225+ }
226+ }
227+ into(layout.buildDirectory.dir(" resources/main" ))
228+ }
229+
230+ tasks.processResources { finalizedBy(setVersionProperty) }
231+ tasks.classes { mustRunAfter(setVersionProperty) }
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import io.micronaut.http.HttpHeaders.USER_AGENT
66import io.micronaut.http.HttpResponse
77import io.micronaut.http.annotation.Get
88import io.micronaut.http.annotation.Header
9- import io.micronaut.http.annotation.Headers
109import io.micronaut.http.annotation.PathVariable
1110import io.micronaut.http.client.annotation.Client
1211import no.ssb.metadata.vardef.integrations.dapla.models.Group
@@ -16,10 +15,8 @@ import no.ssb.metadata.vardef.integrations.dapla.models.Team
1615 * A declarative client for the Dapla Team API
1716 */
1817@Client(id = " dapla-team-api" )
19- @Headers(
20- Header (name = USER_AGENT , value = " VarDef API" ),
21- Header (name = ACCEPT , value = " application/hal+json" ),
22- )
18+ @Header(name = USER_AGENT , value = $$" ${micronaut.http.request- headers.user- agent} " )
19+ @Header(name = ACCEPT , value = " application/hal+json" )
2320interface DaplaTeamApiClient {
2421 @Get(" /teams/{teamId}" )
2522 @SingleResult
Original file line number Diff line number Diff line change @@ -14,10 +14,8 @@ import no.ssb.metadata.vardef.models.SupportedLanguages
1414 * A declarative client for the Klass API
1515 */
1616@Client(id = " klass" )
17- @Headers(
18- Header (name = USER_AGENT , value = " VarDef API" ),
19- Header (name = ACCEPT , value = " application/json" ),
20- )
17+ @Header(name = USER_AGENT , value = $$" ${micronaut.http.request- headers.user- agent} " )
18+ @Header(name = ACCEPT , value = " application/json" )
2119interface KlassApiClient {
2220 @Get(" classifications/{classificationId}" )
2321 @SingleResult
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package no.ssb.metadata.vardef.integrations.vardok.client
22
33import io.micronaut.core.async.annotation.SingleResult
44import io.micronaut.http.HttpHeaders.ACCEPT
5+ import io.micronaut.http.HttpHeaders.USER_AGENT
56import io.micronaut.http.MediaType
67import io.micronaut.http.annotation.Get
78import io.micronaut.http.annotation.Header
@@ -10,6 +11,7 @@ import io.micronaut.http.client.annotation.Client
1011
1112@Client(id = " vardok" )
1213@Produces(MediaType .APPLICATION_XML )
14+ @Header(name = USER_AGENT , value = $$" ${micronaut.http.request- headers.user- agent} " )
1315@Header(name = ACCEPT , value = " application/xml" )
1416interface VardokClient {
1517 @Produces(MediaType .APPLICATION_XML )
Original file line number Diff line number Diff line change 11micronaut :
22 application :
33 name : vardef
4+ version : {{APP_VERSION}} # Placeholder filled by the setVersionProperty task during the Gradle build
45 auth :
56 issuers :
67 labid :
@@ -108,6 +109,8 @@ micronaut:
108109 expire-after-write : 9h
109110 enabled : false
110111 http :
112+ request-headers :
113+ user-agent : ${micronaut.application.name}/${micronaut.application.version} (metadata@ssb.no)
111114 services :
112115 klass :
113116 url : https://data.ssb.no/api/klass/v1/
You can’t perform that action at this time.
0 commit comments