NodeJS ENV Vars

I’m wondering if there is a “Wappler” specific way to set environment variables for NodeJS? I know there’s an $_ENV for server actions, but I’m not talking about that, I’m talking about being able to set process.env.PORT for NodeJS to change the port (using a different port per project to keep the root path clear of project names). For now I just set it in the index.js file, but that feels like a hack. lol Also I don’t want to set “PORT” as a system variable, as it’s too general, and it needs to be per-project.

The standard is to use dotenv package.

I believe this Thursday there is an update coming that will facilitate using libraries.

1 Like

Well those 12 factors seems to be pretty handy! Finally got a good name of all what we have being doing :slight_smile:

https://12factor.net/

1 Like

Yeah. Indeed.

Fun fact: the 12-factor app manifesto was created by Heroku. One of the founders I believe.

@JonL Yeah, I know about that (just easier to put in .js than .env at the time lol), but was wondering if Wappler injected something its own way, but ok good, I’ll just do that, thanks! :wink:

1 Like

The only problem is that that js(and the variable values) will follow you around through all environments.

This has been added to Wappler 4.9.0

This topic was automatically closed after 2 days. New replies are no longer allowed.