Skip to content

Commit c9eda78

Browse files
committed
chore(klesia): adjust rate limiter
1 parent 41f8605 commit c9eda78

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

apps/klesia/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ const api = new OpenAPIHono();
1919
api.use(logger());
2020
api.use(
2121
rateLimiter({
22-
keyGenerator: (c) => getConnInfo(c).remote.address ?? nanoid(),
22+
skip: (c) => c.req.path !== "/api" || c.req.method !== "POST",
23+
keyGenerator: (c) =>
24+
c.req.header("x-forwarded-for") ??
25+
getConnInfo(c).remote.address ??
26+
nanoid(),
2327
limit: 10,
2428
}),
2529
);

packages/klesia-sdk/src/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import { z } from "zod";
55

66
const NetworkMatcher = z.enum(["mainnet", "devnet"]);
77

8-
export const createClient = ({ network }: { network: 'mainnet' | 'devnet' }) => {
8+
export const createClient = ({
9+
network,
10+
}: { network: "mainnet" | "devnet" }) => {
911
return match(NetworkMatcher.parse(network))
1012
.with("devnet", () =>
1113
hc<KlesiaRpc>("https://devnet.klesia.palladians.xyz/api"),
1214
)
1315
.with("mainnet", () =>
1416
hc<KlesiaRpc>("https://mainnet.klesia.palladians.xyz/api"),
1517
)
16-
.exhaustive();
18+
.exhaustive();
1719
};

0 commit comments

Comments
 (0)