From c61e57ae55fc9edce4920c46f71a39f14ff99708 Mon Sep 17 00:00:00 2001 From: Istvan Szenasi Date: Wed, 26 Aug 2015 16:50:58 +0200 Subject: [PATCH 1/2] Add support for custom username and password --- README.md | 2 +- servers-from-env.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae2e4e5..93db3c6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ To establish an encrypted SSH connection it will likely ask for your password fo > supplying ENV variables instead. You can also pass a visual name like this: > > ```bash -> -e VB3_PORT_18083_TCP=10.1.1.4:18083 -e VB3_NAME=MyServer +> -e VB3_PORT_18083_TCP=10.1.1.4:18083 -e VB3_NAME=MyServer -e VB3_USER=VirtualBoxUserName -e VB3_PASSWORD=VirtualBoxUserPassword > ``` Now that all `vboxwebsrv` instance are up, we can link everything together and start our actual phpVirtualBox container. diff --git a/servers-from-env.php b/servers-from-env.php index 006428f..020eb60 100644 --- a/servers-from-env.php +++ b/servers-from-env.php @@ -12,6 +12,9 @@ // actual readable name is stored as "/thiscontainer/givencontainer" $name = getenv($prefix . '_NAME'); + $user = getenv($prefix . '_USER'); + $pass = getenv($prefix . '_PASSWORD'); + $pos = strrpos($name, '/'); if ($pos !== false) { $name = substr($name, $pos + 1); @@ -27,8 +30,8 @@ $servers []= array( 'name' => $name, - 'username' => 'username', - 'password' => 'password', + 'username' => false === $user ? 'username' : $user, + 'password' => false === $pass ? 'password' : $pass, 'authMaster' => true, 'location' => $location ); From 3069f799b3ca457cf70932ca0ec1a2452a30bfa6 Mon Sep 17 00:00:00 2001 From: Istvan Szenasi Date: Wed, 26 Aug 2015 17:23:30 +0200 Subject: [PATCH 2/2] Update phpvirtualbox to 4.3-3 --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 955c1aa..c84afa5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \ wget unzip php5-cli # install phpvirtualbox -RUN wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip/download -O phpvirtualbox-4.3-1.zip -RUN unzip phpvirtualbox-4.3-1.zip -RUN mv phpvirtualbox-4.3-1 /var/www +RUN wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-3.zip/download -O phpvirtualbox-4.3-3.zip +RUN unzip phpvirtualbox-4.3-3.zip +RUN mv phpvirtualbox-4.3-3 /var/www ADD config.php /var/www/config.php RUN chown www-data:www-data -R /var/www