LycheeOrg / Lychee-Docker

Docker image for Lychee
https://lycheeorg.github.io/
165 stars 56 forks source link

New environment variables not added to environment file #184

Closed wkelton closed 6 months ago

wkelton commented 7 months ago

I have been running Lychee for a long time (probably about 4 to 5 years). I really struggled through this recent upgrade. Most of the problems I faced have already been discussed and / or resolved in other issues.

APP_FORCE_HTTPS (maybe APP_URL) needing to be set was my problem. Setting APP_FORCE_HTTPS=true in my docker compose file did not fix things (this resulted in me going down many rabbit holes related to other settings talked about in other issues - wasted many hours).

I forgot that there is an /conf/.env file in a volume. I didn't realize that the environment variables set in my compose file were being written to this file. But, that wasn't happening. Turns out inject.sh is only doing sed. APP_FORCE_HTTPS (and maybe APP_URL) were not being set in that file because they were never there.

I suggest for this project to do the following:

  1. Check the result of sed, if it did not replace anything, append the new variable to the end of the file.
  2. If not 1, print an error message if sed did not replace anything.

A bigger question: why do environment variables need to be in that file instead of being, you know, in the environment?

d7415 commented 7 months ago

Turns out inject.sh is only doing sed. APP_FORCE_HTTPS (and maybe APP_URL) were not being set in that file because they were never there.

That's a good point. I'm really surprised it hasn't come up earlier.

A bigger question: why do environment variables need to be in that file instead of being, you know, in the environment?

That I can't help with. Laravel's documentation claims they should, but as you can see they do not.