From b5f2277d376779ad65fbd171b4783db9f9b69f18 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Thu, 16 Feb 2023 09:28:25 -0800 Subject: [PATCH] Update graphql README and tests for new server configuration. --- .github/workflows/go.yml | 14 +++++--------- cmd/registry-graphql/README.md | 15 +++++++++------ cmd/registry-graphql/graphql/graphql_test.go | 6 ++++++ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e3864ca7..5297acb1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,15 +40,11 @@ jobs: version: v1.45 args: --timeout 5m0s - - name: Install - run: go install ./... + - name: Install the registry tool + run: go install github.com/apigee/registry/cmd/registry@latest - - name: Install registry-server - run: go install github.com/apigee/registry/cmd/registry-server@latest + - name: Create default registry configuration + run: registry config configurations create localhost --registry.address='localhost:8080' - name: Test everything with SQLite - run: registry-server & make test - env: - APG_REGISTRY_ADDRESS: localhost:8080 - APG_REGISTRY_AUDIENCES: http://localhost:8080 - APG_REGISTRY_INSECURE: 1 \ No newline at end of file + run: make test diff --git a/cmd/registry-graphql/README.md b/cmd/registry-graphql/README.md index 92872749..4b0b1fd9 100644 --- a/cmd/registry-graphql/README.md +++ b/cmd/registry-graphql/README.md @@ -14,15 +14,18 @@ provide access to spec revisions or artifact values. ## Invocation -Just run the `registry-graphql` program. It uses the `APG_*` environment -variables to connect to a Registry API server. Because it serves static files, -it should be run in the same directory as its source files. - -If you're building a React or other browser-hosted client application, you -can use the `-cors-allow-origin` flag to allow CORS requests while you are +Just run the `registry-graphql` program. It uses the +[registry](https://github.com/apigee/registry) project's +[pkg/connection](https://github.com/apigee/registry/tree/main/pkg/connection) to +get an authenticated connection to a Registry API server. Because it serves +static files, it should be run in the same directory as its source files. + +If you're building a React or other browser-hosted client application, you can +use the `-cors-allow-origin` flag to allow CORS requests while you are developing your app. This allows you to specify a single allowed origin, which can include `*`, which allows all CORS requests. Take care to quote the `*` to avoid shell expansion: + ``` registry-graphql -cors-allow-origin '*' ``` diff --git a/cmd/registry-graphql/graphql/graphql_test.go b/cmd/registry-graphql/graphql/graphql_test.go index 87e3be33..2244ed0c 100644 --- a/cmd/registry-graphql/graphql/graphql_test.go +++ b/cmd/registry-graphql/graphql/graphql_test.go @@ -22,12 +22,18 @@ import ( "testing" "github.com/apigee/registry/pkg/connection" + "github.com/apigee/registry/pkg/connection/grpctest" "github.com/apigee/registry/rpc" + "github.com/apigee/registry/server/registry" "github.com/graphql-go/graphql" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) +func TestMain(m *testing.M) { + grpctest.TestMain(m, registry.Config{}) +} + func unavailable(err error) bool { if err == nil { return false