Skip to content
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

Update Connect with TLS docs #270

Merged
merged 2 commits into from
Sep 23, 2024
Merged
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
Binary file modified img/getting_started/database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@
"group": "How To",
"pages": [
"redis/howto/connectclient",
"redis/howto/connectwithtls",
"redis/howto/connectwithupstashredis",
"redis/howto/upgradedatabase",
"redis/howto/metricsandcharts",
Expand Down
27 changes: 12 additions & 15 deletions redis/howto/connectclient.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ see the database page as below:
</Frame>

The information required for Redis clients is displayed here as **Endpoint**,
**Port** and **Password**. Also when you click on `Connect` button, you can copy
**Port** and **Password**. Also when you click on `Clipboard` button on **Connect to your database** section, you can copy
the code that is required for your client.

Below, we will provide examples from popular Redis clients, but the information above should help you configure all Redis clients similarly.

<Note>
If you have enabled TLS in your database, please refer to [Connect With
TLS](../howto/connectwithtls) section instead.
TLS is enabled by default for all Upstash Redis databases. It's not possible to disable it.
</Note>

## upstash-redis
Expand All @@ -42,23 +41,20 @@ Below, we will provide examples from popular Redis clients, but the information

**Example**:

```typescript
import { Redis } from "@upstash/redis";
````typescript
import { Redis } from '@upstash/redis';

const redis = new Redis({
url: "UPSTASH_REDIS_REST_URL",
token: "UPSTASH_REDIS_REST_TOKEN",
});
const redis = new Redis({ url: 'UPSTASH_REDIS_REST_URL', token: 'UPSTASH_REDIS_REST_TOKEN' });

(async () => {
try {
const data = await redis.get("key");
const data = await redis.get('key');
console.log(data);
} catch (error) {
console.error(error);
}
})();
```
````

## Node.js

Expand All @@ -69,7 +65,7 @@ const redis = new Redis({
```javascript
const Redis = require("ioredis");

let client = new Redis("redis://:YOUR_PASSWORD@YOUR_ENDPOINT:YOUR_PORT");
let client = new Redis("rediss://:YOUR_PASSWORD@YOUR_ENDPOINT:YOUR_PORT");
fahreddinozcan marked this conversation as resolved.
Show resolved Hide resolved
await client.set("foo", "bar");
let x = await client.get("foo");
console.log(x);
Expand All @@ -86,7 +82,8 @@ import redis
r = redis.Redis(
host= 'YOUR_ENDPOINT',
port= 'YOUR_PORT',
password= 'YOUR_PASSWORD')
password= 'YOUR_PASSWORD',
ssl=True)
r.set('foo','bar')
print(r.get('foo'))
```
Expand All @@ -98,7 +95,7 @@ print(r.get('foo'))
**Example**:

```java
Jedis jedis = new Jedis("YOUR_ENDPOINT", "YOUR_PORT");
Jedis jedis = new Jedis("YOUR_ENDPOINT", "YOUR_PORT", true);
jedis.auth("YOUR_PASSWORD");
jedis.set("foo", "bar");
String value = jedis.get("foo");
Expand All @@ -113,7 +110,7 @@ System.out.println(value);

```go
func main() {
c, err := redis.Dial("tcp", "YOUR_ENDPOINT:YOUR_PORT")
c, err := redis.Dial("tcp", "YOUR_ENDPOINT:YOUR_PORT", redis.DialUseTLS(true))
if err != nil {
panic(err)
}
Expand Down
109 changes: 0 additions & 109 deletions redis/howto/connectwithtls.mdx

This file was deleted.