ZZROTDesign / alpine-ghost

Ghost Container running in Alpine Linux
MIT License
14 stars 13 forks source link

Error with boolean variables #18

Open thiagoalmeidasa opened 7 years ago

thiagoalmeidasa commented 7 years ago

Hi, first of all, congrats for this job.

I don't know how do you use boolean variables from docker-compose because in my tries these variables are converted from boolean to string.

Example:

---
docker-compose
PROD_MAIL_SECURE_CONNECTION: 'false'

And then, inside the container:

> typeof(process.env['PROD_MAIL_SECURE_CONNECTION'])
'string'

To work around this problem, I have edited the config.js file to use JSON.parse in specific variables, but I think the CheckEnvVar function could be improved testing for true or false strings, and then convert the value, like in http://stackoverflow.com/questions/3976714/converting-string-true-false-to-boolean-value

killianbrackey commented 7 years ago

The Docker compose file is simply setting the environment variables in the containers. Becuase Thanks for pointing this out! Environment variables are always strings (no flexibility herehttp://stackoverflow.com/questions/2953646/how-to-declare-and-use-boolean-variables-in-shell-script). process.env['PROD_MAIL_SECURE_CONNECTION'] === 'true should work like the stack overflow you provided. I will take a look at the function's parsing of these variables.