mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-27 12:14:45 +01:00
0545ad285a
* (feat): Check for existing wrangler installation * Add test for pre-installed wrangler * Add changeset * Address CR comments - check for an exact wrangler version match * Tweak the fixture test for the pre-installed-wrangler test * Simplify if/else logic for checking wrangler versions as per review notes * fix(test): Fix execution for fake wrangler installation * fixup! fix(test): Fix execution for fake wrangler installation * Setup new CI test convention for wrangler-action * Remove unncessary ts-expect-error comments --------- Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
25 lines
505 B
TypeScript
25 lines
505 B
TypeScript
type Env = {
|
|
SECRET1?: string;
|
|
SECRET2?: string;
|
|
};
|
|
|
|
export default {
|
|
fetch(request: Request, env: Env) {
|
|
const url = new URL(request.url);
|
|
|
|
if (url.pathname === "/secret-health-check") {
|
|
const { SECRET1, SECRET2 } = env;
|
|
|
|
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
|
|
throw new Error("SECRET1 or SECRET2 is not defined");
|
|
}
|
|
|
|
return new Response("OK");
|
|
}
|
|
|
|
return Response.json({
|
|
...request,
|
|
headers: Object.fromEntries(request.headers),
|
|
});
|
|
},
|
|
};
|