移动一些敏感的数据到.env
.env.example为示例配置文件 用法自己看文件内容
This commit is contained in:
parent
59458cb2d0
commit
ae7e3ae7a9
16
.env.example
Normal file
16
.env.example
Normal file
@ -0,0 +1,16 @@
|
||||
# 这是示例配置文件
|
||||
# 请将其重命名为 .env 并根据需要进行修改
|
||||
|
||||
# 数据库配置
|
||||
DB_HOST=localhost:3306 # 数据库地址
|
||||
DB_NAME=yii2basic # 数据库名
|
||||
DB_USERNAME=root # 数据库用户名
|
||||
DB_PASSWORD= # 数据库密码
|
||||
VERIFY_PROVIDER= # 验证服务提供商[reCAPTCHA,hCaptcha,Turnstile]
|
||||
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI # Google Recaptcha Site Key # Test Site Key
|
||||
RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe # Google Recaptcha Secret # Test Key
|
||||
HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 # hCaptcha Site Key # Test Site Key
|
||||
HCAPTCHA_SECRET=0x0000000000000000000000000000000000000000 # hCaptcha Secret Key # Test Key
|
||||
TURNSTILE_SITE_KEY=1x00000000000000000000AA # Turnstile Site Key # Test Site Key
|
||||
TURNSTILE_SECRET=1x0000000000000000000000000000000AA # Turnstile Secret Key # Test Key
|
||||
COOKIE_VALIDATION_KEY= # Cookie Validation Key
|
@ -4,9 +4,9 @@ use yii\db\Connection;
|
||||
|
||||
return [
|
||||
'class' => Connection::class,
|
||||
'dsn' => 'mysql:host=localhost:3307;dbname=yii2basic',
|
||||
'username' => 'root',
|
||||
'password' => 'chenx221',
|
||||
'dsn' => 'mysql:host='.$_ENV['DB_HOST'].';dbname='.$_ENV['DB_NAME'],
|
||||
'username' => $_ENV['DB_USERNAME'],
|
||||
'password' => $_ENV['DB_PASSWORD'],
|
||||
'charset' => 'utf8',
|
||||
'schemaMap' => [
|
||||
'mysql' => SamIT\Yii2\MariaDb\Schema::class
|
||||
|
@ -6,4 +6,17 @@ return [
|
||||
'senderName' => 'Example.com mailer',
|
||||
// data directory is used to store uploaded files by the user (e.g. root dir for every user's home)
|
||||
'dataDirectory' => '@app/data',
|
||||
'verifyProvider' => $_ENV['VERIFY_PROVIDER'],
|
||||
'reCAPTCHA' => [
|
||||
'siteKey' => $_ENV['RECAPTCHA_SITE_KEY'],
|
||||
'secret' => $_ENV['RECAPTCHA_SECRET'],
|
||||
],
|
||||
'hCaptcha' => [
|
||||
'siteKey' => $_ENV['HCAPTCHA_SITE_KEY'],
|
||||
'secret' => $_ENV['HCAPTCHA_SECRET'],
|
||||
],
|
||||
'Turnstile' => [
|
||||
'siteKey' => $_ENV['TURNSTILE_SITE_KEY'],
|
||||
'secret' => $_ENV['TURNSTILE_SECRET'],
|
||||
]
|
||||
];
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
|
||||
$dotenv->load();
|
||||
$params = require __DIR__ . '/params.php';
|
||||
$db = require __DIR__ . '/db.php';
|
||||
|
||||
@ -16,7 +17,7 @@ $config = [
|
||||
'components' => [
|
||||
'request' => [
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => '9vuTNyfQqTOWY8fhAajrAhOfX_uaZqZZ',
|
||||
'cookieValidationKey' => $_ENV['COOKIE_VALIDATION_KEY'],
|
||||
],
|
||||
// 'cache' => [
|
||||
// 'class' => 'yii\caching\FileCache',
|
||||
|
Loading…
x
Reference in New Issue
Block a user