-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(redis): use '@vercel/kv' instead 'ioredis'
- Loading branch information
Showing
9 changed files
with
96 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Necessary | ||
# | ||
POSTGRES_PRISMA_URL=postgresql://<user>:<passsword>@localhost:5432/bibata | ||
POSTGRES_URL_NON_POOLING=postgresql://<user>:<passsword>@localhost:5432/bibata | ||
|
||
# Run docker container first | ||
# docker run \ | ||
# -it -d -p 8080:80 --name bibata-dev-kv \ | ||
# -e SRH_MODE=env \ | ||
# -e SRH_TOKEN=supertoken \ | ||
# -e SRH_CONNECTION_STRING="redis://localhost:6379" \ | ||
# hiett/serverless-redis-http:latest | ||
KV_URL=http://localhost:8080 | ||
KV_REST_API_URL=http://localhost:8080/rest | ||
KV_REST_API_TOKEN=supertoken | ||
|
||
GITHUB_ID= | ||
GITHUB_SECRET= | ||
|
||
FIGMA_TOKEN= | ||
FIGMA_FILE= | ||
|
||
# | ||
# Secrets | ||
# | ||
# for secret generation run: openssl rand -base64 32 | ||
NEXTAUTH_SECRET= | ||
NEXT_PUBLIC_JWT_SECRET= | ||
FLASK_SECRET= | ||
SVG_FETCH_SECRET= | ||
|
||
# | ||
# Dev Only | ||
# | ||
VERCEL_ENV=development | ||
FLASK_ENV=development | ||
NEXTAUTH_URL=http://localhost:3000/api/auth/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { kv } from '@vercel/kv'; | ||
|
||
import { SVG } from 'bibata/app'; | ||
|
||
export class ImageRedis { | ||
constructor() {} | ||
|
||
public async del(key: string) { | ||
return await kv.del(key); | ||
} | ||
|
||
public async get(key: string) { | ||
return await kv.get(key); | ||
} | ||
|
||
public async saveSVGs(key: string, value: SVG[]) { | ||
const res = await kv.set(key, JSON.stringify(value)); | ||
res && console.info(`Updated Type '${key}'`); | ||
} | ||
|
||
public async rmOldUrls() { | ||
const keys = await kv.keys('i-*'); | ||
if (keys && keys.length > 0) { | ||
const num = await kv.del(...keys); | ||
console.log(`Deleted ${num} URLs.`); | ||
} | ||
} | ||
|
||
public async saveUrls(key: string, name: string, urls: (string | null)[]) { | ||
const res = await kv.set(key, JSON.stringify(urls)); | ||
res && console.info(`Updated '${name}':`); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters