-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add PSM_BASE_URL as possible environment variable #13
base: master
Are you sure you want to change the base?
Conversation
for PSM instances running behind a reverse proxy with https the PSM_BASE_URL configuration in the config.php is required to prevent browsers from warning about insecure forms when editing/adding servers or users. see phpservermon/phpservermon#1140 This commit will add the line define('PSM_BASE_URL', 'https://[...]'); to the config-php on container startup if the PSM_BASE_URL environment Variable is set/passed.
for some reason when i pulled the repo and built the container, the maria-wait.sh file did not have the execute bit set and the container failed to start. excplicitly setting the execute bit in the dockerfile fixes this problem
@@ -20,6 +20,10 @@ define('PSM_DB_PREFIX', '${MYSQL_DATABASE_PREFIX}'); | |||
?> | |||
EOF | |||
|
|||
if [ ${PSM_BASE_URL} != false ]; then | |||
sed -i "s|?>|define('PSM_BASE_URL', '$PSM_BASE_URL');\n?>|1" ${APACHE_DOCUMENT_ROOT}/config.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the 1
for? I've never seen that before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it means replace first ocurrence only
it was in the sed command I copied from so I just left it.
g
would also work obviously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Can this be merged in, please? :) |
I encountered the problem described here: phpservermon/phpservermon#1140
and the solution is to add a PSM_BASE_URL setting to the config.php.
Because the config.php is automatically created on each container start, i decided to make it configurable via an environment variable.
If the variable is not set, the config.php is not changed.
If the variable is set the line
define('PSM_BASE_URL', '<content of the env-variable>');
will be added to the config.php on container start.