linuxserver / docker-grav

GNU General Public License v3.0
31 stars 11 forks source link

GRAV_ENVIRONMENT not honored #16

Closed psy0rz closed 2 years ago

psy0rz commented 2 years ago

As per documentation, this variable is used for multi site setup: https://learn.getgrav.org/17/advanced/multisite-setup

Since its probably filtered somewhere, grav will fall back to the default environment which is based on the visited domain. This has unintended consquences.

github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

psy0rz commented 2 years ago

I fiddled around a bit: First you have to set S6_KEEP_ENV=1 via docker.

Then you need to adjust both php.ini and the www php-fpm config file to allow environment variables. Maybe there's an official way for it?

thespad commented 2 years ago

Allowing PHP to retain envs isn't too difficult a change, we can certainly look to do it. S6_KEEP_ENV shouldn't be required as the nginx service is run with contenv which passes the container environment to it.

psy0rz commented 2 years ago

No, php needs the environment variables, not nginx?

aptalca commented 2 years ago

php is also run with contenv so it has access to the vars

But like spad said, php by default ignores the system env vars. There is a flag you need to add to the php-local.ini so it doesn't ignore them

psy0rz commented 2 years ago

Could you perhaps add an option for that as well?

thespad commented 2 years ago

Can you please test with lspipepr/grav:1.7.35-pkg-9023161a-pr-18 and see if it works as desired.

psy0rz commented 2 years ago

uuh..whats the full image-url i put in my compose file?

j0nnymoe commented 2 years ago

That is the image repo/name.

psy0rz commented 2 years ago

thanks, that works! grav/php now sees the variable.

I'm not sure when grav decides to create an actual environment. (on my production server it does, somehow, and on my test it never does) But thats a grav-thing, so i'll figure that out.

Thanks!

thespad commented 2 years ago

PR is merged so once it's built in ~30 minutes you can switch back to the "normal" image again.

psy0rz commented 2 years ago

very nice, i love linuxserver images :)