Skip to content

Commit

Permalink
env variable stopgap that works in dev and release
Browse files Browse the repository at this point in the history
astro is really bad/inconsistent at handling this. i thought,
5d71a00 would fix it, but no. now dev
is broken.

there is already an issue for getting this fixed: withastro/astro#9827
i hope they can deal with this in a somewhat timely manner, so we don't
need to rely on such hacks anymore
  • Loading branch information
pixelcmtd committed Feb 19, 2024
1 parent 5d71a00 commit c9553ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/backendlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { createClient, type User, type AuthError, type UserMetadata, type Postgr
import type { AstroCookies } from "astro";
import NodeCache from "node-cache";
import type { Check, Template, TemplateRevision, check, check_data, check_revision, template, template_revision } from "./base";
import env from "./env";

type ValOrErr<V, E> = [V, null] | [null, E];

export const supabase = createClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_ANON_KEY!,
env.SUPABASE_URL,
env.SUPABASE_ANON_KEY,
{ auth: { flowType: "pkce" } }
);

Expand Down
5 changes: 5 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default { ...(import.meta as any).env, ...process.env } as {
readonly SUPABASE_URL: string;
readonly SUPABASE_ANON_KEY: string;
readonly HCAPTCHA_SITEKEY: string;
};

0 comments on commit c9553ab

Please sign in to comment.