You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add privatePrefix for private environment variables (#9996)
Closes#9776.
Adds a new config option, config.kit.env.privatePrefix, for setting a private prefix on environment variables. This defaults to ''.
To prevent super-weird and unexpected behaviors, the logic is:
- private: does not begin with public prefix, does begin with private prefix
- public: does begin with public prefix, does not begin with private prefix
This has the side benefit of not allowing the two prefixes to be the same.
Note: Had to create env.js utils file so that the utils could be imported into server/index -- putting them pretty much anywhere else ended up causing a transitive dependency on some node package somewhere that wasn't compatible with Node 16.
---------
Co-authored-by: Simon H <[email protected]>
Copy file name to clipboardExpand all lines: packages/kit/src/exports/public.d.ts
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -372,6 +372,11 @@ export interface KitConfig {
372
372
* @default "PUBLIC_"
373
373
*/
374
374
publicPrefix?: string;
375
+
/**
376
+
* A prefix that signals that an environment variable is unsafe to expose to client-side code. Environment variables matching neither the public nor the private prefix will be discarded completely. See [`$env/static/private`](/docs/modules#$env-static-private) and [`$env/dynamic/private`](/docs/modules#$env-dynamic-private).
377
+
* @default ""
378
+
*/
379
+
privatePrefix?: string;
375
380
};
376
381
/**
377
382
* Where to find various files within your project.
0 commit comments