Open Kumjami opened 8 years ago
That doesn't really remove the need to set up env vars though, since the code you describe above would look like:
AwsHelper.init({
...regularParams,
websocketServer: process.env.WEBSOCKET_SERVER_URL,
s3Bucket: process.env.AWS_S3_SEARCH_RESULT_BUCKET,
snsTopic: process.env.SEARCH_RESULT_TOPIC
});
I think I do agree with the idea though, a re-usable module shouldn't be loading it's own configuration. Rather it should have any required config passed in.
@lennym that's exactly what I mean.
As far as it's a module. I don't like so much the need to set up some env vars to be able to use it. I think it could be better just to set the required env vars as properties while initializing.
What do you think? Maybe it's something stupid.