Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add env var for configuration #27

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ COPY --from=builder /workspace/bin/ciam-rebac /usr/local/bin/
COPY --from=builder /workspace/configs/config.yaml /usr/local/bin/

ENV SPICEDB_PRESHARED $SPICEDB_PRESHARED
ENV SPICEDB_ENDPOINT $SPICEDB_ENDPOINT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having a discussion about the use of env vars here? We were pretty committed to using file mounts before (no env vars in previous Dockerfile: https://github.com/RedHatInsights/authz/blob/main/Dockerfile).

I seem to remember people mentioning security concerns around the lines of it being easier to expose an app's environment that the contents of a file.

ENV SPICEDB_HTTPADDR $SPICEDB_HTTPADDR
ENV SPICEDB_GRPCADDR $SPICEDB_GRPCADDR

EXPOSE 8000
EXPOSE 9000

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ cd cmd/server
wire
```

## Run Rebac service with env

`docker run -e SPICEDB_PRESHARED=foobar -e SPICEDB_HTTPADDR=0.0.0.0:8001 quay.io/ciam_authz/insights-rebac`

## Spicedb using docker/podman

## Run the spicedb
Expand Down
8 changes: 0 additions & 8 deletions cmd/ciam-rebac/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ func main() {
panic(err)
}

preshared, err := c.Value("PRESHARED").String()
if err != nil {
log.NewHelper(logger).Errorf("Failed to read preshared key env %d", err)
}
if preshared != "" {
bc.Data.SpiceDb.Token = preshared
}

app, cleanup, err := wireApp(bc.Server, bc.Data, logger)
if err != nil {
panic(err)
Expand Down
8 changes: 4 additions & 4 deletions configs/config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
server:
http:
addr: 0.0.0.0:8000
addr: "${HTTPADDR:0.0.0.0:8000}"
timeout: 1s
grpc:
addr: 0.0.0.0:9000
addr: "${GRPCADDR:0.0.0.0:9000}"
timeout: 1s
data:
spiceDb:
useTLS: false
endpoint: spicedb:50051
token: "${SPICEDB_PRESHARED:foobar}"
endpoint: "${ENDPOINT:spicedb:50051}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this config been tested with make rebac, etc. It looks odd, but if it works it works. :)

token: "${PRESHARED:foobar}"
Loading