Skip to content

Update proxy version in go/xorm example #40

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

Closed
wants to merge 5 commits into from
Closed
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
1 change: 0 additions & 1 deletion languages/go/goeql
Submodule goeql deleted from 376599
2 changes: 1 addition & 1 deletion languages/go/xorm/.envrc.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export CS_CLIENT_KEY=
# Used by Proxy
export CS_ENCRYPTION__CLIENT_ID=$CS_CLIENT_ID
export CS_ENCRYPTION__CLIENT_KEY=$CS_CLIENT_KEY
export CS_ENCRYPTION__DATASET_ID=
export CS_AUDIT__ENABLED=false
export CS_DATABASE__PORT=5432
export CS_DATABASE__USERNAME=postgres
export CS_DATABASE__PASSWORD=postgres
export CS_DATABASE__NAME=gotest
export CS_DATABASE__HOST=localhost
export CS_TEST_ON_CHECKOUT=true
export CS_STATEMENT_HANDLER=mylittleproxy
22 changes: 8 additions & 14 deletions languages/go/xorm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

## Running / Development

Copy over the example `.envrc` file:

```shell
cp .envrc.example .envrc
```

Create an [account](https://cipherstash.com/signup).

Install the CLI:
Expand All @@ -24,7 +30,7 @@ Login:
stash login
```

Create a [dataset](https://cipherstash.com/docs/how-to/creating-datasets) and [client](https://cipherstash.com/docs/how-to/creating-clients), and record them as `CS_CLIENT_ID` and `CS_CLIENT_KEY`.
Create a [dataset](https://cipherstash.com/docs/how-to/creating-datasets) and [client](https://cipherstash.com/docs/how-to/creating-clients), and record them as `CS_CLIENT_ID` and `CS_CLIENT_KEY` and `CS_ENCRYPTION__DATASET_ID`.

```shell
stash datasets create xorm
Expand All @@ -35,12 +41,6 @@ stash clients create xorm --dataset-id $CS_DATASET_ID
# grab the client key and export CS_CLIENT_KEY=
```

Upload the `dataset.yml` file in this directory.

```shell
stash datasets config upload --file dataset.yml --client-id $CS_CLIENT_ID --client-key $CS_CLIENT_KEY --assume-yes
```

Create an [access key](https://cipherstash.com/docs/how-to/creating-access-keys) for CipherStash Proxy:

```shell
Expand All @@ -50,12 +50,6 @@ stash access-keys create --workspace-id $CS_WORKSPACE_ID xorm
# grab the client access key and export CS_CLIENT_ACCESS_KEY=
```

Copy over the example `.envrc` file:

```shell
cp .envrc.example .envrc
```

Update the `.envrc` file with these environment variables `CS_WORKSPACE_ID`, `CS_CLIENT_ACCESS_KEY`, `CS_CLIENT_ID` and `CS_CLIENT_KEY`:

```shell
Expand Down Expand Up @@ -190,7 +184,7 @@ Example:
SELECT cs_add_index_v1('examples', 'encrypted_text_field', 'unique', 'text', '{"token_filters": [{"kind": "downcase"}]}');
SELECT cs_add_index_v1('examples', 'encrypted_text_field', 'match', 'text');
SELECT cs_add_index_v1('examples', 'encrypted_text_field', 'ore', 'text');
SELECT cs_add_index_v1('examples', 'encrypted_jsonb_field', 'ste_vec', 'jsonb', '{"prefix": "some-prefix"}');
SELECT cs_add_index_v1('examples', 'encrypted_jsonb_field', 'ste_vec', 'jsonb', '{"prefix": "examples/encrypted_jsonb_field"}');

-- The below indexes will also need to be added to enable full search functionality on the encrypted columns

Expand Down
1 change: 0 additions & 1 deletion languages/go/xorm/dataset.yml

This file was deleted.

3 changes: 2 additions & 1 deletion languages/go/xorm/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- ./init-db:/docker-entrypoint-initdb.d
proxy:
container_name: gotest_proxy
image: cipherstash/cipherstash-proxy:cipherstash-proxy-v0.1.0
image: cipherstash/cipherstash-proxy:cipherstash-proxy-v0.2.0
depends_on:
- postgres
ports:
Expand All @@ -23,6 +23,7 @@ services:
CS_CLIENT_ACCESS_KEY: $CS_CLIENT_ACCESS_KEY
CS_ENCRYPTION__CLIENT_ID: $CS_ENCRYPTION__CLIENT_ID
CS_ENCRYPTION__CLIENT_KEY: $CS_ENCRYPTION__CLIENT_KEY
CS_ENCRYPTION__DATASET_ID: $CS_ENCRYPTION__DATASET_ID
CS_TEST_ON_CHECKOUT: "true"
CS_AUDIT__ENABLED: "false"
CS_DATABASE__PORT: 5432
Expand Down
2 changes: 1 addition & 1 deletion languages/go/xorm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.3
require github.com/stretchr/testify v1.9.0

require (
github.com/cipherstash/goeql v0.1.1
github.com/cipherstash/goeql v0.1.2
github.com/cockroachdb/apd v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gofrs/uuid v4.0.0+incompatible // indirect
Expand Down
4 changes: 2 additions & 2 deletions languages/go/xorm/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
github.com/cipherstash/goeql v0.1.1 h1:FmoPuC2p9k9oXzUm3LR/vka1zUXfaIR4wJ7zJuhIa48=
github.com/cipherstash/goeql v0.1.1/go.mod h1:ZCxu+TEwv3Zb82EJI/Sm8UrNKLEKg/D19Tkf08D6tCU=
github.com/cipherstash/goeql v0.1.2 h1:vXSm782iB+MJ7VIz0pxA/3MFJ7Z1oiSeI4UAGYvPx7g=
github.com/cipherstash/goeql v0.1.2/go.mod h1:ZCxu+TEwv3Zb82EJI/Sm8UrNKLEKg/D19Tkf08D6tCU=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
4 changes: 2 additions & 2 deletions languages/go/xorm/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func AddIndexes(engine *sql.DB) {
SELECT cs_add_index_v1('examples', 'encrypted_text_field', 'match', 'text');
SELECT cs_add_index_v1('examples', 'encrypted_text_field', 'ore', 'text');
SELECT cs_add_index_v1('examples', 'encrypted_int_field', 'ore', 'int');
SELECT cs_add_index_v1('examples', 'encrypted_jsonb_field', 'ste_vec', 'jsonb', '{"prefix": "some-prefix"}');
SELECT cs_add_index_v1('examples', 'encrypted_jsonb_field', 'ste_vec', 'jsonb', '{"prefix": "examples/encrypted_jsonb_field"}');
SELECT cs_add_index_v1('examples', 'encrypted_bool_field', 'ore', 'boolean');

CREATE UNIQUE INDEX ON examples(cs_unique_v1(encrypted_text_field));
CREATE INDEX ON examples USING GIN (cs_match_v1(encrypted_text_field));
CREATE INDEX ON examples (cs_ore_64_8_v1(encrypted_text_field));
CREATE INDEX ON examples USING GIN (cs_ste_vec_v1(encrypted_jsonb_field));
-- CREATE INDEX ON examples USING GIN (cs_ste_vec_v1(encrypted_jsonb_field));
CREATE INDEX ON examples (cs_ore_64_8_v1(encrypted_int_field));
CREATE INDEX ON examples (cs_ore_64_8_v1(encrypted_bool_field));

Expand Down