Yes good question, the author hasn't mentioned the templating system they're using here or how they've put exposed commit hash as an environment variable.
But for most JS/Next.js projects to use environment variables would use process.env like so:
release: process.env.COMMIT_HASH
Or, because this would be directly exposed to the client-side (i.e. public), like this with Next.js:
Note that the Amplify build environment exposes the git commit hash for you by default. So if you need use that env var locally, you'll need to get the actual git commit hash, and then expose it as an env var yourself (for consistency perhaps), which is another story... e.g. javascript.plainenglish.io/passing...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not quite understand this part:
How can it be set exactly in JS/next.js projects?
Yes good question, the author hasn't mentioned the templating system they're using here or how they've put exposed commit hash as an environment variable.
But for most JS/Next.js projects to use environment variables would use
process.env
like so:Or, because this would be directly exposed to the client-side (i.e. public), like this with Next.js:
Reference: nextjs.org/docs/basic-features/env...
Note that the Amplify build environment exposes the git commit hash for you by default. So if you need use that env var locally, you'll need to get the actual git commit hash, and then expose it as an env var yourself (for consistency perhaps), which is another story... e.g. javascript.plainenglish.io/passing...