Closed rojvv closed 3 months ago
Check out https://github.com/search?q=repo%3Adenoland%2Ffresh%20deno_deployment_id&type=code
Currently fresh just looks for this environment variable. Could you you do the same in your plugin?
Not all servers are deployed on Deno Deploy. I want a built-in alternative to Deno.mainModule.endsWith("dev.ts")
. This is already there in the server context I guess, but it is a private property: #dev
.
I updated the title and the description to precisely describe the issue.
Thanks, that makes sense. But FYI https://fresh.deno.dev/docs/concepts/deployment#docker. It's important to set that environment variable, if you're not running on deploy.
Exposing the internal dev flag is probably more clear.
Actually, this also makes sense for the end user’s side (like the developer working on the routes, not the user visiting the website). Some logic might be production-only or vice-versa.
In Fresh 2 plugins have access to the Fresh config object.
// Logs: "development" or "production
console.log(app.config.mode)
https://github.com/denoland/fresh/blob/e3508c30541018e6384ce8b373baf17d3dc52673/src/server/context.ts#L148
Should this be public?