<?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']}\"\n";
$str .= "APP_SECRET=\"" . bin2hex(openssl_random_pseudo_bytes(12)) . "\"\n";
file_put_contents('.env.local', $str);
file_put_contents('index.php', "<?php header('location: public/'); ?>");