Search code examples
phplaravelenvironment-variablesopenshiftredhat

Hiding .env file as OpenShift Secret


I have a laravel project that is hosted in OpenShift.

I need to hide my .env from public git so I created it as OpenShift Secret and try to mount volume to /var/www/magic/

However, this will cause the deployment to fail with CrashLoopBackOff with Terminal showing

DocumentRoot Error: Unable to find /opt/app-root/rh/var/www/magic/public, not found or unreadable.

However, there is no issue for my dsa-known-hosts secret at /opt/app-root/src/.ssh/

Is there anyone experience with PHP & OpenShift to help?


Solution

  • After using Will Gordan's advice, adding subPath in the template yaml was the solution. It allows me to mount the file as it instead of replacing the directory.