mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-17 19:01:19 +01:00
Complete heroku setup
This commit is contained in:
parent
bf495f9019
commit
37892e912e
3
Procfile
3
Procfile
@ -1 +1,2 @@
|
|||||||
web: vendor/bin/heroku-php-nginx public/
|
web: vendor/bin/heroku-php-nginx -C nginx.conf public/
|
||||||
|
release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache
|
29
app.json
29
app.json
@ -15,21 +15,28 @@
|
|||||||
"repository": "https://github.com/Bubka/2FAuth",
|
"repository": "https://github.com/Bubka/2FAuth",
|
||||||
"success_url": "/register",
|
"success_url": "/register",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postdeploy": "php -r \"file_exists('.env') || copy('.env.heroku', '.env')\";php artisan migrate:refresh;php artisan passport:install;php artisan storage:link"
|
"postdeploy": [
|
||||||
|
"php artisan passport:install",
|
||||||
|
"php artisan storage:link"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"APP_KEY": {
|
"APP_KEY": {
|
||||||
"description": "The encryption key for your database and sessions.",
|
"generator": "secret"
|
||||||
"value": "base64:OfTFROuxY2NHE321rcwz0N4UW/SSXWEjzxOGiQD7nCY="
|
},
|
||||||
}
|
"APP_NAME": "2FAuth",
|
||||||
|
"APP_ENV": "review",
|
||||||
|
"APP_DEBUG": "false",
|
||||||
|
"LOG_CHANNEL": "errorlog",
|
||||||
|
"DB_CONNECTION": "pgsql",
|
||||||
|
"CACHE_DRIVER": "redis",
|
||||||
|
"QUEUE_CONNECTION": "redis",
|
||||||
|
"SESSION_DRIVER": "redis",
|
||||||
|
"TRUSTED_PROXIES": "*"
|
||||||
},
|
},
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
"heroku-postgresql",
|
||||||
"plan": "heroku-postgresql",
|
"heroku-redis"
|
||||||
"options": {
|
|
||||||
"version": "13"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"buildpacks": [
|
"buildpacks": [
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', env('HEROKU_APP_NAME') ? 'https://' . env('HEROKU_APP_NAME') . '.herokuapp.com' : 'http://localhost'),
|
||||||
|
|
||||||
'asset_url' => env('ASSET_URL', null),
|
'asset_url' => env('ASSET_URL', null),
|
||||||
|
|
||||||
@ -119,7 +119,7 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'key' => env('APP_KEY'),
|
'key' => strpos(env('APP_KEY'), 'base64:') !== false ? env('APP_KEY') : substr(env('APP_KEY'), 0, 32),
|
||||||
|
|
||||||
'cipher' => 'AES-256-CBC',
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
@ -2,6 +2,23 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
$databaseUrl = getenv('DATABASE_URL');
|
||||||
|
$host = '';
|
||||||
|
$username = '';
|
||||||
|
$password = '';
|
||||||
|
$database = '';
|
||||||
|
$port = '';
|
||||||
|
|
||||||
|
if (false !== $databaseUrl) {
|
||||||
|
$options = parse_url($databaseUrl);
|
||||||
|
|
||||||
|
$host = $options['host'] ?? '127.0.0.1';
|
||||||
|
$username = $options['user'] ?? 'forge';
|
||||||
|
$password = $options['pass'] ?? '';
|
||||||
|
$database = substr($options['path'] ?? '/forge', 1);
|
||||||
|
$port = $options['port'];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -53,11 +70,11 @@
|
|||||||
'mysql' => [
|
'mysql' => [
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DATABASE_URL'),
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', $host),
|
||||||
'port' => env('DB_PORT', '3306'),
|
'port' => env('DB_PORT', $port ?? '3306'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', $database),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', $username),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', $password),
|
||||||
'unix_socket' => env('DB_SOCKET', ''),
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
'collation' => 'utf8mb4_unicode_ci',
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
@ -73,11 +90,11 @@
|
|||||||
'pgsql' => [
|
'pgsql' => [
|
||||||
'driver' => 'pgsql',
|
'driver' => 'pgsql',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DATABASE_URL'),
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', $host),
|
||||||
'port' => env('DB_PORT', '5432'),
|
'port' => env('DB_PORT', $port ?? '5432'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', $database),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', $username),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', $password),
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
|
10
nginx.conf
Normal file
10
nginx.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
if ($http_x_forwarded_proto != 'https') {
|
||||||
|
rewrite ^ https://$host$request_uri? permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri @rewriteapp;
|
||||||
|
}
|
||||||
|
location @rewriteapp {
|
||||||
|
rewrite ^(.*)$ /index.php$1 last;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user