Skip to content

Commit 4fb2fd7

Browse files
committed
fix: use playground setup in xorm example
1 parent d2f873c commit 4fb2fd7

File tree

11 files changed

+112
-148
lines changed

11 files changed

+112
-148
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Store encrypted data alongside your existing data:
1313
- Encrypted data is stored using a `jsonb` column type
1414
- Query encrypted data with specialized SQL functions
1515
- Index encrypted columns to enable searchable encryption
16-
- Integrate with [CipherStash Proxy](/docs/tutorials/PROXY.md) for transparent encryption/decryption
16+
- Integrate with [CipherStash Proxy](/docs/tutorials/PROXY.md) for transparent encryption/decryption.
1717

1818
## Table of Contents
1919

@@ -65,6 +65,8 @@ The simplest way to get up and running with EQL is to execute the install SQL fi
6565
EQL relies on [CipherStash Proxy](docs/tutorials/PROXY.md) for low-latency encryption & decryption.
6666
We plan to support direct language integration in the future.
6767

68+
If you want to use CipherStash Proxy with the below examples or the [helper packages](#helper-packages-and-examples), you can use the [playground environment](playground/README.md).
69+
6870
## Documentation
6971

7072
You can read more about the EQL concepts and reference guides in the [documentation directory](docs/README.md).

examples/go/xorm/.envrc.example

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/go/xorm/README.md

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,63 +10,15 @@
1010

1111
## Running / Development
1212

13-
Create an [account](https://cipherstash.com/signup).
14-
15-
Install the CLI:
16-
17-
```shell
18-
brew install cipherstash/tap/stash
19-
```
20-
21-
Login:
22-
23-
```shell
24-
stash login
25-
```
26-
27-
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`.
28-
29-
```shell
30-
stash datasets create xorm
31-
# grab dataset ID and export CS_DATASET_ID=
32-
33-
stash clients create xorm --dataset-id $CS_DATASET_ID
34-
# grab the client ID and export CS_CLIENT_ID=
35-
# grab the client key and export CS_CLIENT_KEY=
36-
```
37-
38-
Create an [access key](https://cipherstash.com/docs/how-to/creating-access-keys) for CipherStash Proxy:
39-
40-
```shell
41-
stash workspaces
42-
# grab the workspace ID and export CS_WORKSPACE_ID=
43-
stash access-keys create --workspace-id $CS_WORKSPACE_ID xorm
44-
# grab the client access key and export CS_CLIENT_ACCESS_KEY=
45-
```
46-
47-
Copy over the example `.envrc` file:
48-
49-
```shell
50-
cp .envrc.example .envrc
51-
```
52-
53-
Update the `.envrc` file with these environment variables `CS_WORKSPACE_ID`, `CS_CLIENT_ACCESS_KEY`, `CS_CLIENT_ID`, `CS_CLIENT_KEY` and `CS_DATASET_ID`:
54-
55-
```shell
56-
source .envrc
57-
```
58-
59-
Start Postgres and CipherStash Proxy and install EQL:
60-
61-
```shell
62-
./run.sh setup
63-
```
64-
65-
Run tests:
66-
67-
```shell
68-
./run.sh tests
69-
```
13+
1. Set up the [playground environment](../../playground/README.md).
14+
2. Run the setup script:
15+
```shell
16+
./run.sh setup
17+
```
18+
3. Run tests:
19+
```shell
20+
./run.sh tests
21+
```
7022

7123
## Integrating EQL into a Xorm app
7224

examples/go/xorm/docker-compose.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

examples/go/xorm/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
func proxyEngine() *xorm.Engine {
1616

17-
proxyConnStr := "user=postgres password=postgres port=6432 host=localhost dbname=gotest sslmode=disable"
17+
proxyConnStr := "user=postgres password=postgres port=6432 host=localhost dbname=postgres sslmode=disable"
1818
proxyEngine, err := xorm.NewEngine("pgx", proxyConnStr)
1919

2020
if err != nil {

examples/go/xorm/init-db/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/go/xorm/init-db/create-db.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/go/xorm/init-db/init.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/go/xorm/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ func (eb *EncryptedBoolField) FromDB(data []byte) error {
124124
}
125125

126126
func createTable() {
127-
connStr := "user=postgres password=postgres port=5432 host=localhost dbname=gotest sslmode=disable"
127+
connStr := "user=postgres password=postgres port=5432 host=localhost dbname=postgres sslmode=disable"
128128
engine, err := xorm.NewEngine("pgx", connStr)
129129

130130
if err != nil {
131-
log.Fatalf("Could not connect to gotest database: %v", err)
131+
log.Fatalf("Could not connect to postgres database: %v", err)
132132
}
133133

134134
// need to map from struct to postgres snake case lowercase
@@ -145,7 +145,7 @@ func createTable() {
145145
}
146146

147147
func addIndexesConstraints() {
148-
connStr := "user=postgres password=postgres port=5432 host=localhost dbname=gotest sslmode=disable"
148+
connStr := "user=postgres password=postgres port=5432 host=localhost dbname=postgres sslmode=disable"
149149
// Install Eql, custom types, indexes and constraints
150150
// To install our custom types we need to use the database/sql package due to an issue
151151
// with how xorm interprets `?`.

examples/go/xorm/run.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ if [ "${BASH_SOURCE[0]}" != "./run.sh" ]; then
1515
fi
1616

1717
subproject_setup() {
18-
# start postgres and proxy (create db and install eql)
19-
docker compose up -d
2018
# constraints and indexes
2119
go run . setupDev
2220
}
2321

24-
subproject_teardown() {
25-
# start postgres
26-
docker compose down
27-
}
28-
2922
subproject_tests(){
3023
# run e2e tests
3124
make gotest
@@ -37,10 +30,6 @@ case $subcommand in
3730
subproject_setup
3831
;;
3932

40-
teardown)
41-
subproject_teardown
42-
;;
43-
4433
tests)
4534
subproject_tests
4635
;;

0 commit comments

Comments
 (0)