dever 6 years ago
parent
commit
a1e04173e1
1 changed files with 28 additions and 6 deletions
  1. 28 6
      config/env/localhost/default.php

+ 28 - 6
config/env/localhost/default.php

@@ -1,20 +1,42 @@
 <?php
 
+
+# 验证dc是否存在,一般在share目录下
+$dc = array();
+$dc_file = '/share/dc/config.php';
+if (is_file($dc_file)) {
+    $dc = include($dc_file);
+}
+
+if (isset($dc['data'])) {
+    $config['base']['data'] = $dc['data'];
+}
+
+$create = false;
+if (isset($dc['mysql']['create'])) {
+    $create = $dc['mysql']['create'];
+}
+
+$ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
+
+$local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
+
 # 数据库配置
 $config['database'] = array
 (
+    'create' => $create,
 	# 默认数据库配置
 	'default' => array
 	(
 		'type' => 'pdo',
 		'host' => array
 		(
-			'read' => 'web-mysql:3306',
-			'update' => 'web-mysql:3306',
+			'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
+			'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
 		),
 		'database' => 'wonderful',
-		'username' => 'root',
-		'password' => '123456',
+		'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
+		'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
 		'charset' => 'utf8',
 	),
 );
@@ -24,7 +46,6 @@ $config['debug'] = array
 	'log' => array('type' => 'file'),
 );
 
-$local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '192.168.33.10';
 
 $host = 'http://'.$local . '/';
 
@@ -34,7 +55,7 @@ $uploadcdn = $host . 'upload/data/';
 $config['host'] = array
 (
     'upload'=> $upload . 'upload/?save',
-    'uploadRes'     => $uploadcdn . 'upload/',
+    'uploadRes'     => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
     'project' => array
     (
         'upload' => array
@@ -51,4 +72,5 @@ $config['host'] = array
         ),
     ),
 );
+
 return $config;