Add a `process.env.PROJECT_ORIGIN` field

Hi,

I think it can be useful to have a reliable property to use on Glitch but also locally, to have the URL origin (like https://project-name.glitch.me)

Is it possible, please? :slight_smile:

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

SECRET=example-secret-0001
PROJECT_ORIGIN=https://subdomain.glitch.me

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)}.glitch.me`

… it works… but it needs to add the .glitch.me 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.