/**
  * @expectedException \SURFnet\VPN\Server\Exception\ConnectionException
  * @expectedExceptionMessage client not allowed, not a member of "all"
  */
 public function testAclIsNoMember()
 {
     $c = new Connection(__DIR__);
     $c->connect(['INSTANCE_ID' => 'vpn.example', 'POOL_ID' => 'bar', 'common_name' => 'xyz_abc', 'time_unix' => 1234567890, 'ifconfig_pool_remote_ip' => '10.10.10.25', 'ifconfig_pool_remote_ip6' => 'fd00:1234::25']);
 }
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once sprintf('%s/vendor/autoload.php', dirname(__DIR__));
use SURFnet\VPN\Server\Connection;
use SURFnet\VPN\Server\Exception\ConnectionException;
use SURFnet\VPN\Common\Logger;
$logger = new Logger(basename($argv[0]));
$envData = [];
try {
    $envKeys = ['INSTANCE_ID', 'POOL_ID', 'common_name', 'time_unix', 'ifconfig_pool_remote_ip', 'ifconfig_pool_remote_ip6'];
    // read environment variables provided by OpenVPN
    foreach ($envKeys as $envKey) {
        $envValue = getenv($envKey);
        if (empty($envValue)) {
            throw new RuntimeException(sprintf('environment variable "%s" is not set', $envKey));
        }
        $envData[$envKey] = $envValue;
    }
    $connection = new Connection(dirname(__DIR__));
    $connection->connect($envData);
    $envData['ok'] = true;
    $logger->info(json_encode($envData));
} catch (ConnectionException $e) {
    $envData['ok'] = false;
    $envData['error_msg'] = $e->getMessage();
    $logger->error(json_encode($envData));
    exit(1);
} catch (Exception $e) {
    $logger->error($e->getMessage());
    exit(1);
}