<?php

$scratch = getenv('ROUNDCUBE_SCRATCH');

$config = [];
$config['db_dsnw'] = "sqlite:///{$scratch}/roundcube.db?mode=0600";
$config['temp_dir'] = "{$scratch}/temp/";
$config['log_driver'] = 'stdout';
$config['des_key'] = getenv('ROUNDCUBE_DES_KEY');

// The sandbox reaches Microsoft 365 only through tunnel.py's CONNECT tunnels on 127.0.0.1.
$config['ivy_microsoft_host'] = 'ssl://127.0.0.1:10993';
$config['imap_host'] = [$config['ivy_microsoft_host'] => 'Microsoft 365'];
$config['smtp_host'] = ['127.0.0.1' => 'tls://127.0.0.1:10587'];
$config['imap_conn_options'] = ['127.0.0.1' => ['ssl' => ['peer_name' => 'outlook.office365.com']]];
$config['smtp_conn_options'] = ['127.0.0.1' => ['ssl' => ['peer_name' => 'smtp.office365.com']]];

$greenmail = getenv('ROUNDCUBE_GREENMAIL');
if ($greenmail) {
    $config['imap_host']["{$greenmail}:3143"] = 'GreenMail';
    $config['smtp_host'][$greenmail] = "{$greenmail}:3025";
}
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';

$config['product_name'] = 'Roundcube';
$config['plugins'] = ['ivy_microsoft'];
$config['skin'] = 'elastic';
$config['enable_installer'] = false;
// Ivy frames the app at the instance's own origin.
$config['x_frame_options'] = false;
