-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[server] Add spicedb client #16197
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
[server] Add spicedb client #16197
Conversation
started the job as gitpod-build-mp-spicedb-server-client.2 because the annotations in the pull request description changed |
export function spicedbClientFromEnv(): v1.ZedPromiseClientInterface { | ||
const token = process.env["SPICEDB_PRESHARED_KEY"]; | ||
if (!token) { | ||
throw new Error("No spicedb token configured."); | ||
} | ||
|
||
const address = process.env["SPICEDB_ADDRESS"]; | ||
if (!address) { | ||
throw new Error("No spicedb address configured."); | ||
} | ||
|
||
const client = v1.NewClient(token, address, v1.ClientSecurity.INSECURE_PLAINTEXT_CREDENTIALS); | ||
return client.promises; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it, do we need to guard for the case where the experimental config for SpiceDB is not set, and therefore SpiceDB doesn't exist? This could then prevent the instance from starting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed this by making the type possibly undefined. The constructor no longer throws, when the env vars are undefined. The use of the client can then check.
0ddda96
to
2a69ecb
Compare
/werft run with-clean-slate-deployment=true 👍 started the job as gitpod-build-mp-spicedb-server-client.4 |
2a69ecb
to
5ad8f32
Compare
/werft run 👍 started the job as gitpod-build-mp-spicedb-server-client.6 |
/unhold |
Description
Adds basic spicedb client. We'll likely need to adjust a few things, but this helps keep subsequent changes smaller, and it ensures we land the spicedb dependency without too many other changes.
Related Issue(s)
How to test
Release Notes
Documentation
Build Options:
Experimental feature to run the build with GitHub Actions (and not in Werft).
leeway-target=components:all
Run Leeway with
--dont-test
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh