<?php
include('public/legacy/config.php');
$c = $sugar_config['dbconfig'];
/*
$str = "DATABASE_URL=\"mysql://{$c['db_user_name']}:{$c['db_password']}@localhost/{$c['db_name']}\"";
file_put_contents('.env.local', $str);
*/
$str = <<<STR
<?php
return array (
'APP_ENV' => 'prod',
'CORS_ALLOW_ORIGIN' => '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$',
'DATABASE_URL' => 'mysql://{$c['db_user_name']}:{$c['db_password']}@localhost/{$c['db_name']}',
'AUTH_TYPE' => 'native',
'LOCK_DSN' => 'flock',
'LOGIN_THROTTLING_MAX_ATTEMPTS' => '5',
);
STR;
file_put_contents('.env.local.php', $str);
file_put_contents('index.php', "<?php header('location: public/'); ?>");