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

Dev/Prod mode? #84

Closed
nickguimond opened this issue Jan 10, 2022 · 2 comments
Closed

Dev/Prod mode? #84

nickguimond opened this issue Jan 10, 2022 · 2 comments

Comments

@nickguimond
Copy link

https://github.com/lucacasonato/fresh/blob/95289380f3f8bb85c8cc2d0fc3e5ab2ab4de9962/src/server/context.ts#L39

Dev/Prod mode is determined by assuming the end user is using Deno Deploy. I just set a random string for now in my use case but would be nice if this was a config option or something agnostic to the deployment environment. Or even just something to mention how to manually override in the docs.

@lino-levan
Copy link
Contributor

lino-levan commented Oct 19, 2022

There hasn't been a ton of progress on this front but I do want to clarify to anyone reading the thread that we do have docs on how to deploy outside of Deno. Those docs do mention the environment variable:

When packaging your Fresh app for Docker, it is important that you set the DENO_DEPLOYMENT_ID environment variable in your container. This variable needs to be set to an opaque string ID that represents the version of your application that is currently being run. This could be a Git commit hash, or a hash of all files in your project. It is critical for the function of Fresh that this ID changes when any file in your project changes - if it doesn't, incorrect caching will cause your project to not function correctly.

Ideally this would just be something like env=PROD but ¯\_(ツ)_/¯

@lucacasonato
Copy link
Member

Fresh does not really have much of a prod vs dev mode. The main difference is how caching works.

For caching to work correctly in prod, a unique identifier representing the source code (ie the git commit or a source code hash) needs to be provided to fresh. This is done via the DENO_DEPLOYMENT_ID env var. If this not set, Fresh can not cache, and thus can not activate "prod" mode.

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

3 participants