mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-26 06:46:40 +00:00
♻️ validate env and add remote fossorial API as an env variable
This commit is contained in:
@@ -10,6 +10,7 @@ import { supporterKey } from "@server/db";
|
||||
import { db } from "@server/db";
|
||||
import { eq } from "drizzle-orm";
|
||||
import config from "@server/lib/config";
|
||||
import { pullEnv } from "@app/lib/pullEnv";
|
||||
|
||||
const validateSupporterKeySchema = z
|
||||
.object({
|
||||
@@ -31,6 +32,7 @@ export async function validateSupporterKey(
|
||||
next: NextFunction
|
||||
): Promise<any> {
|
||||
try {
|
||||
const env = pullEnv();
|
||||
const parsedBody = validateSupporterKeySchema.safeParse(req.body);
|
||||
if (!parsedBody.success) {
|
||||
return next(
|
||||
@@ -44,7 +46,7 @@ export async function validateSupporterKey(
|
||||
const { githubUsername, key } = parsedBody.data;
|
||||
|
||||
const response = await fetch(
|
||||
"https://api.fossorial.io/api/v1/license/validate",
|
||||
`${env.app.fossorialRemoteAPIBaseUrl}/api/v1/license/validate`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user