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

Add console experience for topaz #134

Merged
merged 12 commits into from
Oct 6, 2023
Merged
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
env:
VAULT_ADDR: https://vault.eng.aserto.com/
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'main' || '' }}
GO_VERSION: "1.19"
GO_VERSION: "1.20"
GO_RELEASER_VERSION: "v1.20.0"

jobs:
Expand All @@ -46,8 +46,7 @@ jobs:
-
name: Build
run: |
go build -o ./bin/topaz ./cmd/topaz/
go build -o ./bin/topazd ./cmd/topazd/
go run mage.go deps build
-
name: Lint
uses: golangci/golangci-lint-action@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
./pkg/testing/assets/bundle.tar.gz
./pkg/testing/assets/*ds.db

# console static files that get copied at build
/pkg/app/console/*

# allow test assets
!pkg/testing/assets/*.db
!pkg/testing/assets/config*.yaml
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ linters-settings:
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 18
min-complexity: 20
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
before:
# https://goreleaser.com/customization/hooks/
hooks:
- ./pre-build.sh {{ .Env.CONSOLE_VERSION }}

builds:
# https://goreleaser.com/customization/build/
Expand Down
34 changes: 6 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
ARG GO_VERSION
FROM golang:$GO_VERSION-alpine AS build-dev
RUN apk add --no-cache bash build-base git tree curl protobuf openssh
WORKDIR /src

ENV GOBIN=/bin
ENV ROOT_DIR=/src

# generate & build
ARG VERSION
ARG COMMIT

COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=ssh \
go run mage.go deps build

FROM alpine
ARG VERSION
ARG COMMIT

LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.source=https://github.com/aserto-dev/topaz
LABEL org.opencontainers.image.title="Topaz"
LABEL org.opencontainers.image.revision=$COMMIT
LABEL org.opencontainers.image.url=https://aserto.com

RUN apk add --no-cache bash tzdata
WORKDIR /app
COPY --from=build-dev /src/dist/topazd_linux_amd64_v1/topazd /app/

EXPOSE 8282
EXPOSE 8383
EXPOSE 8484
EXPOSE 8585
EXPOSE 9292
EXPOSE 9393
EXPOSE 8080

WORKDIR /app

COPY dist/topazd_linux_amd64_v1/topazd /app/

ENTRYPOINT ["./topazd"]
2 changes: 2 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ EXPOSE 8383
EXPOSE 8484
EXPOSE 8585
EXPOSE 9292
EXPOSE 9393
EXPOSE 8080

WORKDIR /app

Expand Down
25 changes: 13 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/aserto-dev/topaz

go 1.19

replace github.com/aserto-dev/go-edge-ds => ../go-edge-ds
// replace github.com/aserto-dev/go-edge-ds => ../go-edge-ds

require (
github.com/alecthomas/kong v0.8.0
Expand All @@ -13,17 +13,18 @@ require (
github.com/aserto-dev/errors v0.0.6
github.com/aserto-dev/go-aserto v0.20.3
github.com/aserto-dev/go-authorizer v0.20.2
github.com/aserto-dev/go-directory v0.21.8-0.20230913224642-68ab4803494f
github.com/aserto-dev/go-directory v0.21.8-0.20230928155853-8b1ea7613972
github.com/aserto-dev/go-directory-cli v0.20.14-0.20230913232053-927068a67595
github.com/aserto-dev/go-edge-ds v0.21.10-0.20230817220143-d98c270b7069
github.com/aserto-dev/go-edge-ds v0.21.10-0.20231001180400-3a18c38dfac4
github.com/aserto-dev/go-grpc v0.8.57
github.com/aserto-dev/header v0.0.5
github.com/aserto-dev/logger v0.0.4
github.com/aserto-dev/openapi-authorizer v0.8.81
github.com/aserto-dev/openapi-directory v0.21.6-0.20230802231916-c64b7b8884fd
github.com/aserto-dev/runtime v0.54.2
github.com/aserto-dev/self-decision-logger v0.0.4
github.com/aserto-dev/service-host v0.0.3
github.com/aserto-dev/service-host v0.0.5
github.com/cli/browser v1.2.0
github.com/fatih/color v1.15.0
github.com/fullstorydev/grpcurl v1.8.7
github.com/google/uuid v1.3.1
Expand All @@ -38,20 +39,20 @@ require (
github.com/onsi/gomega v1.27.10
github.com/open-policy-agent/opa v0.54.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.30.0
github.com/rs/zerolog v1.31.0
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.opencensus.io v0.24.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.58.0
google.golang.org/grpc v1.58.2
google.golang.org/protobuf v1.31.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
sigs.k8s.io/controller-runtime v0.15.0
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230830185350-7a34d6557349.1 // indirect
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230914171853-63dfe56cc2c4.1 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
Expand All @@ -62,7 +63,7 @@ require (
github.com/aserto-dev/go-http-metrics v0.10.1-20221024-1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bufbuild/protocompile v0.5.1 // indirect
github.com/bufbuild/protovalidate-go v0.3.1 // indirect
github.com/bufbuild/protovalidate-go v0.3.2 // indirect
github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/containerd v1.7.2 // indirect
Expand All @@ -78,7 +79,7 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/cel-go v0.18.0 // indirect
github.com/google/cel-go v0.18.1 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/subcommands v1.2.0 // indirect
Expand Down Expand Up @@ -153,9 +154,9 @@ require (
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
29 changes: 27 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230830185350-7a34d6557349.1 h1:EJ219uXJze+1BiAeTcr74DLurguVNNvhiA9wyy/SK+M=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230830185350-7a34d6557349.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230914171853-63dfe56cc2c4.1 h1:2gmp+PRca1fqQHf/WMKOgu9inVb0R0N07TucgY3QZCQ=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230914171853-63dfe56cc2c4.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
Expand Down Expand Up @@ -79,8 +81,14 @@ github.com/aserto-dev/go-decision-logs v0.0.4 h1:beu/mhqZ92ovhSIPOv2f4q0Ci7HWNLl
github.com/aserto-dev/go-decision-logs v0.0.4/go.mod h1:W50DNu4HPCk+iyI39cP3+KBytdrQYVieSPXh9StuRzA=
github.com/aserto-dev/go-directory v0.21.8-0.20230913224642-68ab4803494f h1:0hnPmlSH23cIiOLjXeSXUj4sQrHBYDykyUOEqUpfG2I=
github.com/aserto-dev/go-directory v0.21.8-0.20230913224642-68ab4803494f/go.mod h1:ZsHSXALiP6F49/+zKDZP6GIcAWyYX95lkSVxM+8Jwno=
github.com/aserto-dev/go-directory v0.21.8-0.20230928155853-8b1ea7613972 h1:9S88ed3EiV5IxDNeojltYOSkROYdXRrIh9IGc0aloEg=
github.com/aserto-dev/go-directory v0.21.8-0.20230928155853-8b1ea7613972/go.mod h1:0sI6RoKUYGJ5G3APnJcpf7RlRDRRBsGcMj7eb72NPq0=
github.com/aserto-dev/go-directory-cli v0.20.14-0.20230913232053-927068a67595 h1:t/L3jN8AhLQsqbJq7AD/zFMNQDH3sT+lKiM7VoIfMk4=
github.com/aserto-dev/go-directory-cli v0.20.14-0.20230913232053-927068a67595/go.mod h1:+tWMBAzEd+TW7m0PEhVYTX50h4Nju1au+J151yeEUdA=
github.com/aserto-dev/go-edge-ds v0.21.10-0.20230918210437-130da75a4874 h1:q+IqDuGTfH0GF6+rtGkqaxNsWZwa/Cb/ScOZyShq8R0=
github.com/aserto-dev/go-edge-ds v0.21.10-0.20230918210437-130da75a4874/go.mod h1:CupD7d2BmNksBgJO/wogA62TM5TBqiy1atVBRlddqeQ=
github.com/aserto-dev/go-edge-ds v0.21.10-0.20231001180400-3a18c38dfac4 h1:Nq2785pk1IoO9T2Dqd6nPAjYJ1QAiA58lYLDPbhqzxA=
github.com/aserto-dev/go-edge-ds v0.21.10-0.20231001180400-3a18c38dfac4/go.mod h1:BBFAgWcqWQ733AHKv4rP0NhFQwG5yOWzIgwkxVtsb8g=
github.com/aserto-dev/go-grpc v0.8.57 h1:CjQVxZ2HkBvJrfCtaDeq2kZSn2yLmRel5kHCVzqRMLs=
github.com/aserto-dev/go-grpc v0.8.57/go.mod h1:2FcclMDheTsEvYCY72o+EwTaoO0ti3/it4G6xIlzNIM=
github.com/aserto-dev/go-http-metrics v0.10.1-20221024-1 h1:nONd24V5nyJ0IIw8QE+OKv30YuHOTNbJ4FsvczLaM8o=
Expand All @@ -97,15 +105,17 @@ github.com/aserto-dev/runtime v0.54.2 h1:9M9J38rf+gUeBH3PngRMSHn3W8oTvy6qga8169Y
github.com/aserto-dev/runtime v0.54.2/go.mod h1:KYF4DZo5lIWMvRg4QQioypxdi2mDwZF7DmPggAK+2Dg=
github.com/aserto-dev/self-decision-logger v0.0.4 h1:Thlz9QTlJm0X+uC3YLUTSyvX+VgF2wVIk9Wh8+rkE/c=
github.com/aserto-dev/self-decision-logger v0.0.4/go.mod h1:YJVf6HiAf5UeykhFxHe0dE+ODC8fUEF+PWteSDyJKw4=
github.com/aserto-dev/service-host v0.0.3 h1:C0TKtrkA0/QlhNzHdjQDOKwmTPNBnUPqQiIXuYvceeU=
github.com/aserto-dev/service-host v0.0.3/go.mod h1:xkPJgw1WjoML0uth5A2Leu4zwl+OoUTySQ4MraLK5RQ=
github.com/aserto-dev/service-host v0.0.5 h1:yvcUnfByaHMHDXgO0FmFsSGbGBBfhODN3hKHoVa+LwY=
github.com/aserto-dev/service-host v0.0.5/go.mod h1:KnjlBCcPN3fBZ3qTHu3rubxoPKJQpHrOrP6OEMgHIuE=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg=
github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40=
github.com/bufbuild/protovalidate-go v0.3.1 h1:+jbgQXo+7SzttLbGwVClpHowXKEgwK1QG/bK4xrmUy8=
github.com/bufbuild/protovalidate-go v0.3.1/go.mod h1:oD/fAR3ojBAunOmY3SGFJ4jhILpUtnuIalI4Id9rluY=
github.com/bufbuild/protovalidate-go v0.3.2 h1:7sG1R83PkCzOZb3P187gAchWFLHY6LQ8aVoUw6Wp9es=
github.com/bufbuild/protovalidate-go v0.3.2/go.mod h1:ywZqKUjMhQA8fmhsc+0DUlMfan8/umJ+5mKvjdxAD3M=
github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA=
github.com/bytecodealliance/wasmtime-go/v3 v3.0.2/go.mod h1:RnUjnIXxEJcL6BgCvNyzCCRzZcxCgsZCi+RNlvYor5Q=
github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4=
Expand All @@ -117,6 +127,8 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cli/browser v1.2.0 h1:yvU7e9qf97kZqGFX6n2zJPHsmSObY9ske+iCvKelvXg=
github.com/cli/browser v1.2.0/go.mod h1:xFFnXLVcAyW9ni0cuo6NnrbCP75JxJ0RO7VtCBiH/oI=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -226,6 +238,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/cel-go v0.18.0 h1:u74MPiEC8mejBrkXqrTWT102g5IFEUjxOngzQIijMzU=
github.com/google/cel-go v0.18.0/go.mod h1:PVAybmSnWkNMUZR/tEWFUiJ1Np4Hz0MHsZJcgC4zln4=
github.com/google/cel-go v0.18.1 h1:V/lAXKq4C3BYLDy/ARzMtpkEEYfHQpZzVyzy69nEUjs=
github.com/google/cel-go v0.18.1/go.mod h1:PVAybmSnWkNMUZR/tEWFUiJ1Np4Hz0MHsZJcgC4zln4=
github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM=
github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -426,6 +440,8 @@ github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
Expand Down Expand Up @@ -660,6 +676,7 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -822,10 +839,16 @@ google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA=
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4=
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 h1:vlzZttNJGVqTsRFU9AmdnrcO1Znh8Ew9kCD//yjigk0=
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU=
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI=
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 h1:U7+wNaVuSTaUqNvK2+osJ9ejEZxbjHHk8F2b6Hpx0AE=
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand All @@ -848,6 +871,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o=
google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I=
google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
7 changes: 6 additions & 1 deletion magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (
const containerImage string = "topaz"

func init() {
os.Setenv("GO_VERSION", "1.19")
os.Setenv("GO_VERSION", "1.20")
os.Setenv("DOCKER_BUILDKIT", "1")
os.Setenv("CONSOLE_VERSION", "0.0.0-20231003140254.0.gde72c90c")
}

// Generate generates all code.
Expand Down Expand Up @@ -51,6 +52,10 @@ func Test() error {

// DockerImage builds the docker image for the project.
func DockerImage() error {
err := BuildAll()
if err != nil {
return err
}
version, err := common.Version()
if err != nil {
return errors.Wrap(err, "failed to calculate version")
Expand Down
23 changes: 20 additions & 3 deletions pkg/app/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"context"
"fmt"
"net/http"
"time"

"github.com/aserto-dev/go-aserto/client"
Expand All @@ -11,9 +12,11 @@ import (
"github.com/aserto-dev/topaz/decision_log/logger/file"
"github.com/aserto-dev/topaz/decision_log/logger/nop"
"github.com/aserto-dev/topaz/pkg/app/middlewares"
"github.com/aserto-dev/topaz/pkg/app/ui"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"

"github.com/aserto-dev/topaz/pkg/cc/config"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"google.golang.org/grpc"
Expand Down Expand Up @@ -93,6 +96,10 @@ func (e *Authorizer) ConfigServices() error {
e.Services["topaz"] = topaz
}

if _, ok := e.Configuration.Services[consoleService]; ok {
e.Services["console"] = NewConsole()
}

if err := e.validateConfig(); err != nil {
return err
}
Expand Down Expand Up @@ -142,6 +149,14 @@ func (e *Authorizer) ConfigServices() error {
if err != nil {
return err
}

if contains(serviceConfig.registeredServices, "console") {
server.Gateway.Mux.Handle("/ui/", ui.UIHandler(http.FS(console)))
server.Gateway.Mux.Handle("/public/", ui.UIHandler(http.FS(console)))
server.Gateway.Mux.HandleFunc("/api/v1/config", ui.ConfigHandler(e.Configuration))
server.Gateway.Mux.HandleFunc("/api/v1/authorizers", ui.AuthorizersHandler(e.Configuration))
}

err = e.Manager.AddGRPCServer(server)
if err != nil {
return err
Expand Down Expand Up @@ -241,8 +256,10 @@ func (e *Authorizer) validateConfig() error {
}

for key := range e.Configuration.Services {
if !(contains(e.Services["edge"].AvailableServices(), key) || key == authorizerService) {
return errors.Errorf("unknown service type %s", key)
if _, ok := e.Services["edge"]; ok {
if !(contains(e.Services["edge"].AvailableServices(), key) || key == authorizerService || key == consoleService) {
return errors.Errorf("unknown service type %s", key)
}
}
}
return nil
Expand Down
Loading
Loading