Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENV variables for laravel SSL properties #158

Open
crixle opened this issue Dec 1, 2023 · 5 comments
Open

ENV variables for laravel SSL properties #158

crixle opened this issue Dec 1, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@crixle
Copy link

crixle commented Dec 1, 2023

Description of the feature

Adding ENV variables like DB_SSL_CERT_PATH for laravel to use when connecting to SQL databases that require SSL.

Benftits of feature

Required when using Azure MySQL databases unless manually turned off

Additional context

I have an Azure Web App deployment of this image but it's lacking these environment variables required to pass a root cert for SSL validation.

@crixle crixle added the enhancement New feature or request label Dec 1, 2023
@tiredofit
Copy link
Owner

You should be able to add that variable to your config manually and it shouldn't get clobbered on restart of container. Let me know if that works and allows an install.

@crixle
Copy link
Author

crixle commented Dec 4, 2023

Thank you for such a fast reply!

database.php gets rewritten after adding the MYSQL_ATTR_SSL_CERT option to mySQL. I've tried redeploying the web app with the same configuration to no avail as well.

Here's the database.php entry before restarting for reference.
image

@tiredofit
Copy link
Owner

Aha ! I follow you now.
You would want to request this as a feature to the core of Freescout here: https://github.com/freescout-helpdesk/freescout/

However, there is a trick you can do with this image.

If you mount ./assets/custom-scripts:/assets/custom-scripts and create a file with the following like so 01-insert_db_ssl_cert.sh

#!/bin/bash

sed -i "/PDO::MYSQL_ATTR_SSL_CA/a PDF::MYSQL_ATTR_SSL_CERT => env ('DB_MYSQL_ATTR_SSL_CERT')," /www/html/config/database.php

and then chmod +x 01-insert_db_ssl_cert.sh it will get added to the database.php file each time the container starts.

Hopefully that will help you in the short term?

If it doesn't work there are a few more ways we can get the script to fire ahead of the freescout install proess.

@crixle
Copy link
Author

crixle commented Dec 4, 2023

Unfortunately that didn't work :( I submitted a feature request to freescout core and I'll wait to see if they adopt it.

If you want to provide other methods to run scripts before the install process, then I'll gladly take them!
Otherwise, thank you very much for your assistance.

@tiredofit
Copy link
Owner

You will want to not have your script in /assets/custom-scripts this time, but something different..

You can put it somewhere and use NGINX_POST_INIT_SCRIPT=<path to your script.sh> which will execute it before the Freescout install process occurs.

You'll want to change the sed command to operate on /assets/install/config/database.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants