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

Question: how to install "env.js" in new project? #120

Open
FuadEfendi opened this issue Jul 16, 2021 · 7 comments
Open

Question: how to install "env.js" in new project? #120

FuadEfendi opened this issue Jul 16, 2021 · 7 comments

Comments

@FuadEfendi
Copy link

env.js will load environment from testenv.

I am newbie and cannot find any clue how it works... how to configure it for new project? "dotenv"?

Please document few words in README and here; thanks!

@FuadEfendi
Copy link
Author

I found README in subfolder

@FuadEfendi FuadEfendi reopened this Jul 16, 2021
@FuadEfendi
Copy link
Author

but it is not enough... what about "env.js", any documentation?

@oleksandrpravosudko-okta
Copy link

oleksandrpravosudko-okta commented Jul 16, 2021

@FuadEfendi env.js loads environment variables fromtestenv file in repository root - is this something that does not work for you?

@FuadEfendi
Copy link
Author

It loads testenv in this repository and it works. But I created new repository from scratch, installed "dotenv", copied "env.js", and it doesn't work. Maybe some other dependency/configuration setting is missing?

@oleksandrpravosudko-okta

No other configuration locations I'm aware of - perhaps testenv path (../) is off in your repo?

@FuadEfendi
Copy link
Author

yes I know about relative "../"; it is fixed accordingly; I am just trying to find "who is calling env.js when I run command ng serve and cannot find, some magic. So I assumed it will run automatically, but it doesn't (in my separate project). But it runs in this project. dotenv or something else.

@FuadEfendi
Copy link
Author

FuadEfendi commented Jul 17, 2021

Hi @oleksandrpravosudko-okta,

So I found the answer. env.js is not used at all so changing ../ won't help. Perhaps it is something which could be used in some environments. Maybe with dotenv.

Instead, we are using extra-webpack.config.js:

// Read environment variables from "testenv". Override environment vars if they are already set.
const TESTENV = path.resolve(__dirname, '..', 'testenv');

Thank you!

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