Clean up .env files

This commit is contained in:
Pig Fang 2019-09-12 19:06:18 +08:00
parent 8cb65dd846
commit a87320fe09
4 changed files with 50 additions and 88 deletions

View File

@ -1,31 +1,14 @@
###################################
# Blessing Skin Server #
# Configuration #
###################################
APP_DEBUG=false
APP_ENV=production
WEBPACK_ENV=production
# 本文件中各个配置项的详细说明
# 请访问 http://t.cn/E9G4DTY 查看中文教程
# Be sure to disable debug at production environment!
APP_DEBUG = false
APP_ENV = production
WEBPACK_ENV = production
# Database Configuration
DB_CONNECTION = mysql
DB_HOST = localhost
DB_PORT = 3306
DB_DATABASE = blessingskin
DB_USERNAME = username
DB_PASSWORD = secret
# =========================
# Table Prefix
#
# Change if you want to install multiple BS instances into one database.
# The prefix may only contain letters, numbers, and underscores.
#
DB_PREFIX = null
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=blessingskin
DB_USERNAME=username
DB_PASSWORD=secret
DB_PREFIX=
# Hash Algorithm for Passwords
#
@ -37,26 +20,10 @@ DB_PREFIX = null
#
# New sites are *highly* recommended to use BCRYPT.
#
PWD_METHOD = BCRYPT
PWD_METHOD=BCRYPT
SALT=2c5ca184f017a9a1ffbd198ef69b0c0e
APP_KEY=
# Salt
# Change it to any random string to secure your passwords & tokens.
#
# You can run [php artisan salt:random] to generate a new salt.
#
SALT = 2c5ca184f017a9a1ffbd198ef69b0c0e
# App Key should be setted to any random, *32 character* string,
# otherwise all the encrypted strings will not be safe.
#
# You can run [php artisan key:generate] to generate a new key.
#
APP_KEY=base64:gkb/zouNF6UOSfnr/o+izVMS57WQS3+62YqZBuDyBhU=
# Mail Configuration
#
# Leave MAIL_DRIVER empty to disable features involving sending emails.
#
MAIL_DRIVER = smtp
MAIL_HOST = null
MAIL_PORT = 465
@ -64,11 +31,11 @@ MAIL_USERNAME = null
MAIL_PASSWORD = null
MAIL_ENCRYPTION = null
# Change below lines only if you know what they mean!
CACHE_DRIVER = file
SESSION_DRIVER = file
QUEUE_DRIVER = sync
REDIS_CLIENT=predis
REDIS_HOST = 127.0.0.1
REDIS_PASSWORD = null
REDIS_PORT = 6379

View File

@ -1,40 +1,35 @@
###################################
# Blessing Skin Server #
# Configuration #
###################################
APP_DEBUG=false
APP_ENV=testing
APP_DEBUG = false
APP_ENV = testing
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=root
DB_PREFIX=
DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_DATABASE = test
DB_USERNAME = root
DB_PASSWORD = root
DB_PREFIX = null
PWD_METHOD = BCRYPT
SALT = c67709dd8b7b733aca0d570681fe96cf
PWD_METHOD=BCRYPT
SALT=c67709dd8b7b733aca0d570681fe96cf
APP_KEY=base64:eVX/xzF5NhpGB2luswliFx9XSBsbbAP21wOi68X/P34=
MAIL_DRIVER = smtp
MAIL_HOST = localhost
MAIL_PORT = 465
MAIL_USERNAME = null
MAIL_PASSWORD = null
MAIL_ENCRYPTION = ssl
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=465
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=ssl
CACHE_DRIVER = array
SESSION_DRIVER = array
QUEUE_DRIVER = sync
LOG_CHANNEL = black-hole
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
LOG_CHANNEL=black-hole
REDIS_HOST = 127.0.0.1
REDIS_PASSWORD = null
REDIS_PORT = 6379
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=
REDIS_PORT=6379
PLUGINS_DIR = plugins
PLUGINS_URL = null
PLUGINS_DIR=plugins
PLUGINS_URL=
JWT_SECRET = 1tdM3gXarxYI4KlAHMBo238iC2tEb4I3EtBlZTQQXvInXIt7V2ix7hJ1KTvxCKZW
JWT_SECRET=1tdM3gXarxYI4KlAHMBo238iC2tEb4I3EtBlZTQQXvInXIt7V2ix7hJ1KTvxCKZW

View File

@ -65,37 +65,37 @@ class SetupController extends Controller
$content = $filesystem->get(base_path('.env'));
$content = preg_replace(
'/DB_CONNECTION.+/',
'DB_CONNECTION = '.$request->input('type'),
'DB_CONNECTION='.$request->input('type', ''),
$content
);
$content = preg_replace(
'/DB_HOST.+/',
'DB_HOST = '.$request->input('host'),
'DB_HOST='.$request->input('host', ''),
$content
);
$content = preg_replace(
'/DB_PORT.+/',
'DB_PORT = '.$request->input('port'),
'DB_PORT='.$request->input('port', ''),
$content
);
$content = preg_replace(
'/DB_DATABASE.+/',
'DB_DATABASE = '.$request->input('db'),
'DB_DATABASE='.$request->input('db', ''),
$content
);
$content = preg_replace(
'/DB_USERNAME.+/',
'DB_USERNAME = '.$request->input('username'),
'DB_USERNAME='.$request->input('username', ''),
$content
);
$content = preg_replace(
'/DB_PASSWORD.+/',
'DB_PASSWORD = '.$request->input('password'),
'DB_PASSWORD='.$request->input('password', ''),
$content
);
$content = preg_replace(
'/DB_PREFIX.+/',
'DB_PREFIX = '.$request->input('prefix'),
'DB_PREFIX='.$request->input('prefix', ''),
$content
);
$filesystem->put(base_path('.env'), $content);

View File

@ -51,9 +51,9 @@ class SetupControllerTest extends TestCase
$mock->shouldReceive('get')
->with(base_path('.env'))
->once()
->andReturn('DB_CONNECTION = abc');
->andReturn('DB_CONNECTION=abc');
$mock->shouldReceive('put')
->with(base_path('.env'), 'DB_CONNECTION = '.env('DB_CONNECTION'))
->with(base_path('.env'), 'DB_CONNECTION='.env('DB_CONNECTION'))
->once()
->andReturn(true);
});