Skip to content

Commit d8aa0ef

Browse files
committed
fix: more cors origins changes
1 parent d6f0a90 commit d8aa0ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/auth-server-api/src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const app = express();
1111
app.use(express.json());
1212

1313
// CORS configuration
14+
const allowlist = env.CORS_ORIGINS.split(",").map((origin) => origin.trim());
1415
const corsOrigins = (origin: string | undefined, callback: (err: Error | null, allow?: boolean) => void) => {
15-
const allowlist = env.CORS_ORIGINS.split(",").map((origin) => origin.trim());
1616
if (!origin || allowlist.indexOf(origin) !== -1) {
1717
callback(null, true);
1818
} else {
@@ -48,4 +48,4 @@ app.use((_req: Request, res: Response) => {
4848
res.status(404).json({ error: "Not found" });
4949
});
5050

51-
export { app, corsOrigins };
51+
export { allowlist, app };

packages/auth-server-api/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { Hex } from "viem";
22
import { privateKeyToAccount } from "viem/accounts";
33

4-
import { app, corsOrigins } from "./app.js";
4+
import { allowlist, app } from "./app.js";
55
import { env } from "./config.js";
66

77
// Start server
88
const port = parseInt(env.PORT, 10);
99
app.listen(port, () => {
1010
console.log(`Auth Server API listening on port ${port}`);
11-
console.log(`CORS origins: ${corsOrigins.join(", ")}`);
11+
console.log(`CORS origins: ${allowlist.join(", ")}`);
1212
console.log(`Deployer address: ${privateKeyToAccount(env.DEPLOYER_PRIVATE_KEY as Hex).address}`);
1313
console.log(`RPC URL: ${env.RPC_URL}`);
1414
console.log(`Bundler URL: ${env.BUNDLER_URL}`);

0 commit comments

Comments
 (0)