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

Document how to use dotenv for setting global environment variables #42

Open
endel opened this issue May 3, 2020 · 3 comments
Open

Comments

@endel
Copy link
Member

endel commented May 3, 2020

https://www.npmjs.com/package/dotenv

@arpu
Copy link

arpu commented Jul 30, 2024

are there any infos how to use .env vars with colyseus ?

@endel
Copy link
Member Author

endel commented Jul 30, 2024

hi @arpu 👋 documentation is still missing... if you're using @colyseus/tools it is going to load the env file automatically, based on your NODE_ENV - if NODE_ENV is not set, it falls back to "development".

The following paths are tried, if the first succeeds, the second is ignored:

  • .env.{NODE_ENV}
  • .env

Here's the code that loads the env vars: https://github.com/colyseus/colyseus/blob/3f4ff2adcdf7f5bb5e5148d5a27db20d1a5a9dec/packages/tools/src/loadenv.ts

@arpu
Copy link

arpu commented Jul 30, 2024

Thank you @endel this works for me!

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

2 participants