Add a `process.env.PROJECT_ORIGIN` field


I think it can be useful to have a reliable property to use on Glitch but also locally, to have the URL origin (like

Is it possible, please? :slight_smile:

You can edit .env as a raw text file, and use any key/value pair you want.


Hope this helps!

I already know that but thanks anyway.

The .env solution is difficultly reliable when we try to build an isomorphic app, because it needs a dependency, the contents are secret things and a few difficult, also, to write dynamically on remixes.

The main idea is to be able to do that

  "scripts": {
    "postinstall": "node -e 'process.stdout.write(`export default ${JSON.stringify(process.env.PROJECT_ORIGIN)}`)' > origin.js",

Where origin.js can be retrieved as a module, for both front/back, without any secrets or process.env

if env files can be readable after remix, there would be no point of .env, but it can be used as glitch.PROJECTORIGIN

Here, the idea isn’t to rely on the .env.

My approach doesn’t need it and actually, I do that:

`export default ${JSON.stringify(process.env.PROJECT_NAME)}`

… it works… but it needs to add the manually and change it to be runnable on localhost or any other domain.

When I build some demos, I prefer to create them with the idea to don’t have to modify anything, into the code, even on a glitch remix or locally, to run it.

Actually, there is no trace of the glitch domain into the `process.env´, to rely on it.