Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way for plug-ins to know whether the app is run from dev.ts #2361

Open
roj1512 opened this issue Mar 14, 2024 · 5 comments
Open

Add a way for plug-ins to know whether the app is run from dev.ts #2361

roj1512 opened this issue Mar 14, 2024 · 5 comments

Comments

@roj1512
Copy link
Contributor

roj1512 commented Mar 14, 2024

#dev: boolean;

Should this be public?

@deer
Copy link
Contributor

deer commented Mar 14, 2024

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?

@roj1512
Copy link
Contributor Author

roj1512 commented Mar 14, 2024

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.

@roj1512 roj1512 changed the title Add a way for plug-ins to know whether the environment is production Add a way for plug-ins to know whether the app is run from dev.ts Mar 14, 2024
@roj1512
Copy link
Contributor Author

roj1512 commented Mar 14, 2024

I updated the title and the description to precisely describe the issue.

@deer
Copy link
Contributor

deer commented Mar 14, 2024

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.

@roj1512
Copy link
Contributor Author

roj1512 commented Mar 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants