Closed cbrwizard closed 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...
json
config makes it difficult for CI workflows and isn't really intuitive (IMO) for local development i.e. If the secret
isn't hardcoded into the json file (which it shouldn't be) then this implies a custom script in CI that write's the secret
value to the json configuration; now contributors of projects that use this package need to know there's another source of "env secrets"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!
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.
how about just reading from process.env
? you could read STREAMLINE_SECRET
& STREAMLINE_FAMILIES
(as a space delimited string).
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.
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 🙏