https://github.com/ottonow/aws-secrets-manager-property-source
Kotlin library to resolve secrets in property files via AWS Secretsmanager in a Spring Boot application
https://github.com/ottonow/aws-secrets-manager-property-source
aws aws-secrets-manager kotlin spring-boot
Last synced: 6 months ago
JSON representation
Kotlin library to resolve secrets in property files via AWS Secretsmanager in a Spring Boot application
- Host: GitHub
- URL: https://github.com/ottonow/aws-secrets-manager-property-source
- Owner: ottonow
- License: apache-2.0
- Created: 2018-12-30T17:13:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-30T18:39:50.000Z (over 7 years ago)
- Last Synced: 2024-11-19T16:43:20.805Z (over 1 year ago)
- Topics: aws, aws-secrets-manager, kotlin, spring-boot
- Language: Kotlin
- Size: 62.5 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This kotlin library allows an easy integration for AWS Secretsmanager in your Spring Boot application.
[](https://maven-badges.herokuapp.com/maven-central/de.ottonow/aws-secrets-manager-property-source)
[](https://opensource.org/licenses/Apache-2.0)
## Installation
Artifacts are published to maven central.
Gradle:
`compile de.ottonow:aws-secrets-manager-property-source:0.1.0`
Maven:
```xml
de.ottonow
aws-secrets-manager-property-source
0.1.0
```
## Usage
By including the dependency in your Spring Boot app, the library will be autoconfigured.
Secrets can be stored either as plain text or as JSON with multiple properties in AWS Secretsmanager.
For the property source to attempt resolving a property, the property name must start with **/secret/**.
The secrets are cached for one minute.
### Plaintext
`${/secret/}`
*Example:*
`${/secret/my-service/plaintext-property}`
### JSON Property
`${/secret/.}`
*Example:*
Let's assume we have a secret with the path *shipment-service/rds* that has two JSON properties: username and password.
`${/secret/shipment-service/rds.username}`
`${/secret/shipment-service/rds.password}`
An example configuration of your application yaml might look like this:
```
spring:
datasource:
url: jdbc:postgresql://host:5432/shipment_service # host could retreived from secretsmanager aswell
username: ${/secret/shipment-service/rds.username}
password: ${/secret/shipment-service/rds.password}
platform: POSTGRESQL
```