Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/edufolly/work-with-secrets

Working with Docker secrets in Quarkus
https://github.com/edufolly/work-with-secrets

docker docker-swarm java quarkus swarm

Last synced: 17 days ago
JSON representation

Working with Docker secrets in Quarkus

Awesome Lists containing this project

README

        

# work-with-secrets

## Motivation

> Docker secrets do not set environment variables directly.
> This was a conscious decision, because environment variables can
> unintentionally be leaked between containers.

_from_: https://docs.docker.com/engine/swarm/secrets/#build-support-for-docker-secrets-into-your-images

### SmallRye FileSystem Config Source

https://smallrye.io/docs/smallrye-config/main/config-sources/config-sources.html#filesystem-config-source

### Quarkus PR

https://github.com/quarkusio/quarkus/pull/21478

## Implementation

Using in `build.gradle`:

```groovy
implementation 'io.smallrye.config:smallrye-config-source-file-system'
```

Using in `pom.xml`:

```xml

io.smallrye.config
smallrye-config-source-file-system

```

Check `application.properties`:

```yaml
smallrye.config.source.file.locations=secret-template-folder

# Docker secrets path.
%prod.smallrye.config.source.file.locations=/run/secrets

# This way you can use a docker secret interpolated with a
# datasource connection.
my-injected=${my-secret:-not found}
```

### Endpoints

#### /swagger-ui

Swagger UI.

http://localhost:8080/swagger-ui/

#### /config

Checking the base configuration from `ConfigProvider`.

```shell
curl -s http://localhost:8080/config | jq .
```

#### /injected

Using the secret with a `application.properties` interpolation.

```shell
curl -s http://localhost:8080/injected | jq .
```

---
Version: CHECK_VERSION_IN_BRANCH_PROD