Skip to content

Commit

Permalink
make cors configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
PacoVK committed Jun 7, 2024
1 parent 9e52e57 commit a419a4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[semantic version
* https://github.com/PacoVK/tapir/issues/408[#408 - Add Azure containerapps example]
* https://github.com/PacoVK/tapir/issues/414[#414 - Introduce Elasticsearch authentication configuration]


=== changed

* https://github.com/PacoVK/tapir/issues/406[#406 - Make CORS configurable]

== 0.7.1

=== fixes
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ You can configure Tapir passing the following environment variables:
| AUTH_TOKEN_ATTRIBUTE_FAMILY_NAME | The attribute name in the token where the family name is placed in | X | family_name |
| AUTH_TOKEN_ATTRIBUTE_PREFERRED_USERNAME | The attribute name in the token where the preferred username is placed in | X | preferred_username |
| END_SESSION_PATH | IDP end session path, will be used to logout | X | /protocol/openid-connect/logout |
| CORS_ORIGINS | Configure CORS origins | X | * |

:information_source: A note on the GPG configuration. Quarkus (and therefore Tapir) is based on [Smallrye microprofile](https://smallrye.io/smallrye-config/2.9.1/config/indexed-properties/) and supports indexed properties. Hence, you can add one or more key specifying indexed properties. See example below for passing two GPG keys (**Mind the two subsequent underscores after the index**):
```
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ registry:
password: ${TAPIR_ADMIN_PASSWORD:default}
hostname: ${REGISTRY_HOSTNAME:localhost}
port: ${REGISTRY_PORT:443}
cors:
origins: ${CORS_ORIGINS:*}
auth:
provider: ${AUTH_PROVIDER}
endpoint: ${AUTH_ENDPOINT:http://localhost:8089/realms/tapir}
Expand Down Expand Up @@ -140,7 +142,10 @@ quarkus:
allow-forwarded: true
enable-forwarded-host: ${registry.proxy.enabled}
forwarded-host-header: ${registry.proxy.forwarded-header}
cors: true
cors:
origins: ${registry.cors.origins}
methods: "*"
headers: "*"

"%dev":
registry:
Expand Down

0 comments on commit a419a4a

Please sign in to comment.