浏览代码

FD3-576 leases por db

Guillermo Espinoza 7 年之前
父节点
当前提交
a726d70583
共有 1 个文件被更改,包括 18 次插入6 次删除
  1. 18 6
      src/KeaBundle/Services/BaseKea.php

+ 18 - 6
src/KeaBundle/Services/BaseKea.php

@@ -46,6 +46,7 @@ class BaseKea implements KeaConfigInterface
                     'Dhcp4' => [
                         'control-socket' => $this->controlSocketConfig(),
                         'lease-database' =>$this->leaseDatabaseConfig(),
+                        'hosts-database' =>$this->leaseDatabaseConfig(),
                         'subnet4' => $this->subnet4,
                         'hooks-libraries' => $this->hooks_libraries,
                         'interfaces-config' => $this->getInterfacesConfig(),
@@ -180,13 +181,24 @@ class BaseKea implements KeaConfigInterface
     /**
      * @return array
      */
-    private function leaseDatabaseConfig()
+    private function leaseDatabaseConfig($type = 'mysql')
     {
-        /* "lease-database": {"lfc-interval": 3600,"type": "memfile"} */
-        return array(
-            'lfc-interval' => 3600,
-            'type' => 'memfile'
-        );
+        if ($type == 'mysql') {
+            $config = array(
+                "host": "mysql",
+                "name": "kea",
+                "user": "root",
+                "password": getenv('MYSQL_ROOT_PASSWORD'),
+                "type": "mysql",
+            );
+        } elseif ($type == 'memfile') {
+            $config = array(
+                'lfc-interval' => 3600,
+                'type' => 'memfile'
+            );
+        }
+        
+        return $config;
     }
 
     /**