Spaces:
Sleeping
Sleeping
hiett
commited on
Commit
•
c4b3f6d
1
Parent(s):
401768e
Update readme
Browse files- README.md +9 -1
- example/src/index.ts +3 -0
README.md
CHANGED
@@ -25,7 +25,6 @@ import {Redis} from '@upstash/redis';
|
|
25 |
export const redis = new Redis({
|
26 |
url: "http://localhost:8079",
|
27 |
token: "example_token",
|
28 |
-
responseEncoding: false, // IMPORTANT: Upstash has recently added response encoding, but SRH does not support it yet.
|
29 |
});
|
30 |
```
|
31 |
---
|
@@ -42,6 +41,7 @@ this via HTTP.
|
|
42 |
- Automatically kills redis connections after inactivity
|
43 |
- Supports multiple redis instances, and you can configure unique tokens for each
|
44 |
- Fully supports the `@upstash/redis` TypeScript library.
|
|
|
45 |
|
46 |
## Client usage
|
47 |
This will not work with regular Redis clients, as it is over HTTP and not the redis protocol.
|
@@ -74,6 +74,14 @@ Create a file: `srh-config/tokens.json`
|
|
74 |
}
|
75 |
```
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
### Docker Compose
|
78 |
You'll want the above `tokens.json` file but use this as your connection string:
|
79 |
```json
|
|
|
25 |
export const redis = new Redis({
|
26 |
url: "http://localhost:8079",
|
27 |
token: "example_token",
|
|
|
28 |
});
|
29 |
```
|
30 |
---
|
|
|
41 |
- Automatically kills redis connections after inactivity
|
42 |
- Supports multiple redis instances, and you can configure unique tokens for each
|
43 |
- Fully supports the `@upstash/redis` TypeScript library.
|
44 |
+
- Works inside of GitHub Action's services, so you can run it alongside Redis in your tests.
|
45 |
|
46 |
## Client usage
|
47 |
This will not work with regular Redis clients, as it is over HTTP and not the redis protocol.
|
|
|
74 |
}
|
75 |
```
|
76 |
|
77 |
+
Alternatively, if you are connecting to just one Redis server, you can use environment variables to set the target.
|
78 |
+
```
|
79 |
+
SRH_MODE="env"
|
80 |
+
SRH_TOKEN="example_token"
|
81 |
+
SRH_CONNECTION_STRING="redis://redis:6379"
|
82 |
+
```
|
83 |
+
If you use this strategy, it's important that you set `SRH_MODE=env`. This is because SRH by default uses the file strategy for backwards-compatability.
|
84 |
+
|
85 |
### Docker Compose
|
86 |
You'll want the above `tokens.json` file but use this as your connection string:
|
87 |
```json
|
example/src/index.ts
CHANGED
@@ -6,6 +6,9 @@ const redis = new Redis({
|
|
6 |
|
7 |
// The token you defined in tokens.json
|
8 |
token: "example_token",
|
|
|
|
|
|
|
9 |
});
|
10 |
|
11 |
(async () => {
|
|
|
6 |
|
7 |
// The token you defined in tokens.json
|
8 |
token: "example_token",
|
9 |
+
|
10 |
+
// Response encoding is supported (this is enabled by default)
|
11 |
+
responseEncoding: true,
|
12 |
});
|
13 |
|
14 |
(async () => {
|