Skip to content

Commit

Permalink
Merge pull request #101 from jaconi-io/task/refactor-dev-profile
Browse files Browse the repository at this point in the history
refactor: Unify dev and demo setup
  • Loading branch information
jfiedler-jaconi authored Sep 9, 2022
2 parents ef5fecb + 77fdbdc commit 3c192ca
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 89 deletions.
64 changes: 56 additions & 8 deletions compose/application.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,82 @@
# for local developer convenience read a git-ignored properties file holding credentials
spring.config.import: file:./secret.properties

spring:
cloud:
gateway:
routes:
- id: httpbin
uri: http://httpbin
- id: host-mapping
uri: https://httpbin.org
order: 2
predicates:
- Host={tenant}.localtest.me:8080

# for convenience read a git-ignored properties file holding credentials
spring.config.import: optional:file:./config/secret.properties
- id: host-mapping-with-stage
uri: https://httpbin.org
order: 1
predicates:
- Host={tenant}-{stage}.localtest.me:8080
- id: path-mapping
uri: https://httpbin.org
predicates:
- Path=/tenant/{tenant}/**
- id: host-mapping-static
uri: https://httpbin.org
order: 0
predicates:
- name: TenantFromHost
args:
patterns:
- static.localtest.me:8080
- another-static.localtest.me:8080
tenant: foo
- id: header-mapping
uri: https://httpbin.org
predicates:
- TenantFromHeader=X-Tenant-ID,{tenant}

morp:
default-oauth2-client-registration: keycloak
default-oauth2-client-registration: google

tenant:
foo:
mybar:
registration:
client-secret: secret
client-id: foo
client-secret: bar
myfoo:
claim-constraints:
email_verified: "true"
hd:
- jaconi.io
- example.com
okta:
oauth2-client-registration: okta
foo:
oauth2-client-registration: keycloak
bar:
oauth2-client-registration: keycloak
# showcase tenant specific client secret
registration:
client-secret: another-secret

oauth2-client:
registration:
google:
client-id:
client-secret:
okta:
client-name: Okta-Dev
scope: openid,profile,email
keycloak:
# default client secrets (for all Keycloak tenants)
client-id: morp
client-secret: secret
scope:
- openid
- profile
- email
provider:
okta:
issuer-uri: https://dev-3715202.okta.com
keycloak:
issuer-uri: http://keycloak.localtest.me:9000/realms/{tenant}

2 changes: 1 addition & 1 deletion compose/docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ services:
target: /workspace/config/application.yaml
- type: bind
source: ../secret.properties
target: /workspace/config/secret.properties
target: /workspace/secret.properties
80 changes: 2 additions & 78 deletions src/main/resources/application-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,2 @@
# used for integration test cases - for convenience read a git-ignored properties file holding credentials
spring.config.import: optional:file:./secret.properties

spring:
cloud:
gateway:
routes:
- id: host-mapping
uri: https://httpbin.org
order: 2
predicates:
- Host={tenant}.localtest.me:8080
- id: host-mapping-with-stage
uri: https://httpbin.org
order: 1
predicates:
- Host={tenant}-{stage}.localtest.me:8080
- id: path-mapping
uri: https://httpbin.org
predicates:
- Path=/tenant/{tenant}/**
- id: host-mapping-static
uri: https://httpbin.org
order: 0
predicates:
- name: TenantFromHost
args:
patterns:
- static.localtest.me:8080
- another-static.localtest.me:8080
tenant: foo
- id: header-mapping
uri: https://httpbin.org
predicates:
- TenantFromHeader=X-Tenant-ID,{tenant}

morp:
default-oauth2-client-registration: google

tenant:
mybar:
registration:
client-id: foo
client-secret: bar
myfoo:
claim-constraints:
email_verified: "true"
hd:
- jaconi.io
- example.com
okta:
oauth2-client-registration: okta
foo:
oauth2-client-registration: keycloak
bar:
oauth2-client-registration: keycloak
registration:
client-secret: another-secret

oauth2-client:
registration:
google:
okta:
client-name: Okta-Dev
scope: openid,profile,email
keycloak:
client-id: morp
client-secret: secret
scope:
- openid
- profile
- email
provider:
okta:
issuer-uri: https://dev-3715202.okta.com
keycloak:
issuer-uri: http://${keycloak.host:localhost}:9000/realms/{tenant}

# use the same scenario as our demo
spring.config.import: file:./compose/application.yaml
21 changes: 19 additions & 2 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ server:
name: MORP_SESSION

management:
server:
port: 8081
endpoint:
health:
probes:
Expand All @@ -16,6 +18,9 @@ management:
exposure:
include:
- "*"
health:
redis:
enabled: false
metrics:
distribution:
percentiles-histogram:
Expand All @@ -31,8 +36,7 @@ management:
request:
autotime:
percentiles-histogram: true
server:
port: 8081


spring:
application:
Expand All @@ -51,6 +55,19 @@ spring:
# Non-spring configuration goes here!
morp: {}

---
spring.config.activate.on-profile:
- redis

management:
health:
redis:
enabled: true

spring:
session:
store-type: redis

---
spring.config.activate.on-profile:
- wiretap
Expand Down

0 comments on commit 3c192ca

Please sign in to comment.