Skip to content

Commit 46b2562

Browse files
author
Doris Lam
committed
add flexo auth env var, update docker compose to have token good for 1 year
1 parent 91b22d7 commit 46b2562

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ RUN ./gradlew installDist
66
FROM openjdk:17.0.2-jdk-slim
77
WORKDIR application
88
RUN apt-get update && apt-get install -y procps
9-
COPY --from=build application/build/install/flexo-sysmlv2/ .
10-
ENTRYPOINT ["./bin/flexo-sysmlv2"]
9+
COPY --from=build application/build/install/org.openmbee.flexo.sysmlv2/ .
10+
ENTRYPOINT ["./bin/org.openmbee.flexo.sysmlv2"]
1111
EXPOSE 8080

docker-compose/docker-compose.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,13 @@ services:
8484
image: openmbee/flexo-sysmlv2:demo
8585
hostname: flexo-sysmlv2
8686
container_name: flexo-sysmlv2
87-
environment:
88-
- FLEXO_HOST=layer1-service
89-
- FLEXO_PROTOCOL=http
90-
- FLEXO_PORT=8080
91-
- FLEXO_SYSMLV2_ORG=sysmlv2
87+
env_file:
88+
- ./env/flexo-sysmlv2.env
9289
depends_on:
9390
- layer1-service
9491
ports:
9592
- 8083:8080
96-
93+
9794
networks:
9895
default:
9996
name: flexo-mms-test-network
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FLEXO_HOST=layer1-service
2+
FLEXO_PROTOCOL=http
3+
FLEXO_PORT=8080
4+
FLEXO_SYSMLV2_ORG=sysmlv2
5+
FLEXO_AUTH="Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJmbGV4by1tbXMtYXVkaWVuY2UiLCJpc3MiOiJodHRwOi8vZmxleG8tbW1zLXNlcnZpY2VzIiwidXNlcm5hbWUiOiJ1c2VyMDEiLCJncm91cHMiOlsic3VwZXJfYWRtaW5zIl0sImV4cCI6MTc2OTY3MzYwMH0.UqU5KOPSCbYyqbj3BBZs4u7lWbpHyDHPEd7Tbd4wWsM"

src/main/kotlin/org/openmbee/flexo/sysmlv2/AppMain.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ data class FlexoConfig(
7575
val host: String,
7676
val port: Int,
7777
val org: String,
78-
val defaultTimeout: Long
78+
val defaultTimeout: Long,
79+
val auth: String
7980
)
8081

8182
/**
@@ -88,6 +89,6 @@ val Application.flexoConfig: FlexoConfig
8889
val port = property("flexo.port")?.getString()?.toInt() ?: 8080
8990
val org = property("flexo.org")?.getString() ?: "sysmlv2"
9091
val defaultTimeout = property("flexo.defaultTimeout")?.getString()?.toLong() ?: 60_000L
91-
92-
return FlexoConfig(protocol, host, port, org, defaultTimeout)
92+
val auth = property("flexo.auth")?.getString() ?: ""
93+
return FlexoConfig(protocol, host, port, org, defaultTimeout, auth)
9394
}

src/main/kotlin/org/openmbee/flexo/sysmlv2/Flexo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ suspend fun PipelineContext<*, ApplicationCall>.flexoRequest(method: HttpMethod,
248248

249249
// create request builder
250250
val builder = FlexoRequestBuilder(method)
251-
251+
val auth = call.request.headers["Authorization"]?: GlobalFlexoConfig.auth
252252
// forward auth header from client
253-
builder.addHeaders(HttpHeaders.Authorization to (call.request.headers["Authorization"]?: ""))
253+
builder.addHeaders(HttpHeaders.Authorization to auth)
254254

255255
// apply caller setup
256256
setup(builder)

0 commit comments

Comments
 (0)