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

Environment configs #17

Open
confuser opened this issue Jan 26, 2016 · 6 comments
Open

Environment configs #17

confuser opened this issue Jan 26, 2016 · 6 comments

Comments

@confuser
Copy link

Trying to use environment specific configurations on Edge. However, it only seems to pick up default.yaml on a test environment, and never test.yaml.

I've logged the environment variables, and APIGEE_ENVIRONMENT contains the correct value. However, magic is looking for A127_ENV or NODE_ENV when attempting to load the environment config, which don't appear to be defined.

Is it recommended to define either NODE_ENV or A127_ENV manually based on the APIGEE_ENVIRONMENT at the application level before calling init instead?

@theganyo
Copy link
Contributor

Yes, to link the two together you could simply put something like this at the top of your app file:

process.env.NODE_ENV=process.env.APIGEE_ENVIRONMENT

@confuser
Copy link
Author

Thanks @theganyo what's the reason for not using APIGEE_ENVIRONMENT instead within this module to specify the configuration file?

@theganyo
Copy link
Contributor

There was no particular intent to it other than NODE_ENV being the standard method of control for this kind of thing in node. Retrospectively, I guess one could argue that there may be times that users don't want to use APIGEE_ENVIRONMENT for this purpose, but I'm not sure how strong an argument that really is.

@confuser
Copy link
Author

Thanks for clarifying, I only ask as coming from a native node.js background, it seems odd to me to specify the NODE_ENV at the application/code layer rather than having the process manager specify it.

Can this stance be documented somewhere if it isn't already? My colleagues have also run into this issue before.

@theganyo
Copy link
Contributor

I think that's a fair point, it would be preferable that Edge set NODE_ENV as node developers would expect.

@confuser
Copy link
Author

That would be great, especially as many modules in the ecosystem such as express have slight behavioural differences when run under NODE_ENV=production

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