diff --git a/Dockerfile b/Dockerfile index 8f8cec4..4c1a26b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,23 +23,24 @@ COPY --from=react-build /web/build/ ./web/build/ ENV GO111MODULE=on RUN go mod vendor RUN go generate ./... && \ - CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o service && \ - upx --ultra-brute -qq service && \ - upx -t service + CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o super-graph && \ + upx --ultra-brute -qq super-graph && \ + upx -t super-graph # stage: 3 FROM alpine:latest -WORKDIR /app +WORKDIR / RUN apk add --no-cache tzdata +RUN mkdir -p /config COPY --from=go-build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=go-build /app/service . -COPY --from=go-build /app/config/* ./ +COPY --from=go-build /app/config/* /config/ +COPY --from=go-build /app/super-graph . -RUN chmod +x /app/service +RUN chmod +x /super-graph USER nobody EXPOSE 8080 -CMD ./service +CMD ./super-graph diff --git a/config/allow.list b/config/allow.list index 6731938..1293087 100644 --- a/config/allow.list +++ b/config/allow.list @@ -1,17 +1,5 @@ # http://localhost:8080/ -query { - customers { - id - email - payments { - customer_id - amount - billing_details - } - } -} - query { products(id: $PRODUCT_ID) { name @@ -59,6 +47,15 @@ mutation { } } +variables {} + +{ + me { + id + email + } +} + variables { "update": { @@ -83,3 +80,17 @@ query { } } +variables {} + +query { + customers { + id + email + payments { + customer_id + amount + billing_details + } + } +} + diff --git a/serv/core.go b/serv/core.go index ff120c1..1d26ccb 100644 --- a/serv/core.go +++ b/serv/core.go @@ -269,7 +269,7 @@ func (c *coreContext) resolvePreparedSQL(gql string) ([]byte, *preparedItem, err defer tx.Rollback() if v := c.Value(userIDKey); v != nil { - _, err = tx.Exec(`SET LOCAL SESSION "user.id" = ?`, v) + _, err = tx.Exec(`SET LOCAL "user.id" = ?`, v) if err != nil { return nil, nil, err @@ -285,8 +285,6 @@ func (c *coreContext) resolvePreparedSQL(gql string) ([]byte, *preparedItem, err return nil, nil, err } - // w.WriteString(`SET LOCAL SESSION "user.id" = '{{user_id}}'; `) - fmt.Printf("PRE: %v\n", ps.stmt) return []byte(root), ps, nil @@ -341,7 +339,7 @@ func (c *coreContext) resolveSQL(qc *qcode.QCode) ( defer tx.Rollback() if v := c.Value(userIDKey); v != nil { - _, err = tx.Exec(`SET LOCAL SESSION "user.id" = ?`, v) + _, err = tx.Exec(`SET LOCAL "user.id" = ?`, v) if err != nil { return nil, 0, err