webalys-hq / streamlinehq-npm

The deprecated Streamline NPM package, which will be deleted on 1st November 2022.
https://medium.com/streamline-icons/how-streamline-narrows-down-its-focus-eac6fdb5c6f2
24 stars 5 forks source link

Feedback wanted: reading env values from a separate file isn't ideal #2

Closed cbrwizard closed 3 years ago

cbrwizard commented 3 years ago

I feel like we could find a better way to import the configuration values than requiring to use a private streamlinehq.json file. The most straightforward solution would be to read the parent project's .env file, however that might be too intrusive. Or am I overthinking this?

Streamline team wants your feedback on this 🙏

w0ofy commented 3 years ago

@cbrwizard FWIW I don't think you're overthinking this at all! It's pretty early on but I have a thought on this...

I think using .env for the secret makes a lot of sense. But allow me to deprecate my opinion slightly, I don't know the scope and requirements of this project.

Hope this helps!

cbrwizard commented 3 years ago

Let's see, would using dotenv to read a file .env from the parent project folder for config values help in your case? https://github.com/motdotla/dotenv#path One caveat though: I believe it won't read the env values if you provide them not from a file, but from command line arguments, eg `STREAMLINE_SECRET="QWE" yarn start" because of the way this dotenv config function works.

timc13 commented 3 years ago

how about just reading from process.env? you could read STREAMLINE_SECRET & STREAMLINE_FAMILIES (as a space delimited string).

cbrwizard commented 3 years ago

Support for reading .env file or process.env has been added in 2.1.0 https://github.com/webalys-hq/streamlinehq-npm/releases/tag/2.1.0. Please update, hopefully it will solve your issue.