Skip to content

Commit

Permalink
add env var for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
akoserwal committed Feb 14, 2024
1 parent ac4083d commit e540b46
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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
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}"
token: "${PRESHARED:foobar}"

0 comments on commit e540b46

Please sign in to comment.