Open ThomWright opened 3 years ago
Hello, thanks for reporting! You can indeed provide these values to the ApolloServer
constructor via the apollo
option.
You've pointed out some definite omissions in the docs (including a warning about git-ignoring .env
, which we try to add anywhere we include a mention of it), so I'll leave this open until I resolve those.
Looking at these docs I see no way to configure some basic properties of schema registration using function arguments rather than environment variables.
APOLLO_GRAPH_ID
APOLLO_GRAPH_VARIANT
APOLLO_SERVER_USER_VERSION
APOLLO_SERVER_ID
If there is a way, could someone point me towards it please? If not, could it be added? Either way, could it be added to the docs?
It seems that ApolloServerPluginSchemaReporting would be the place to include (some of?) these, but I see nothing there.
Thank you.
Rant about libraries defining environment variables I see no reason why these should be environment variables. Apollo is a library. I would like to see the configuration I pass to it in my code as function arguments, just like any other library I use. I do not want my libraries relying on global variables. As the application developer, I should get to decide what environment variables my application takes. It should not be determined by the libraries it uses.
This, from the linked docs, I think might encourage bad practice. Many developers might see this then add a
.env
file to their repo and check it in, including their secret API key. I hope I don't need to explain why this is a bad idea! In general I don't think environment variables should live in the application source code repository. See The Twelve-Factor App.