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
I have an "adapter-node" app deployed somewhere, I have different environments (dev, qa, prod) and i would like to provide different values to the csp configuration based on the env variables set in each environment at runtime.
Describe the proposed solution
Maybe sveltekit may support "app.html" like syntax to read the env variables at runtime:
Late response, but for others running into this problem: You could work around this by replacing the env variable names in the hooks.server.ts handle function.
importtype{Handle}from'@sveltejs/kit';import{env}from'$env/dynamic/private';exportconsthandle: Handle=async({ event, resolve })=>{constresponse=awaitresolve(event);// Replace ENV variables in CSPconstcsp=response.headers.get('content-security-policy');response.headers.set('Content-Security-Policy',csp?.replaceAll('APP_PUBLIC_TRUSTED_DOMAIN',env.APP_PUBLIC_TRUSTED_DOMAIN)||'',);returnresponse;};
Describe the problem
I have an "adapter-node" app deployed somewhere, I have different environments (dev, qa, prod) and i would like to provide different values to the csp configuration based on the env variables set in each environment at runtime.
Describe the proposed solution
Maybe sveltekit may support "app.html" like syntax to read the env variables at runtime:
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: