@@ -14,6 +14,7 @@ class AppWizard {
1414
1515 private $ database_config = [
1616 "database_create " => ["type " => "boolean " , "value " => true ],
17+ "database_host " => ["type " => "select " ],
1718 "database_name " => ["type " => "text " , "placeholder " => "auto " ],
1819 "database_user " => ["type " => "text " , "placeholder " => "auto " ],
1920 "database_password " => ["type " => "password " , "placeholder " => "auto " ],
@@ -72,6 +73,18 @@ public function getOptions() {
7273 ]);
7374
7475 if ($ this ->appsetup ->withDatabase ()) {
76+ exec (HESTIA_CMD . "v-list-database-hosts json " , $ output , $ return_var );
77+ $ db_hosts_tmp1 = json_decode (implode ("" , $ output ), true );
78+ $ db_hosts_tmp2 = array_map (function ($ host ) {
79+ return $ host ["HOST " ];
80+ }, $ db_hosts_tmp1 );
81+ $ db_hosts = array_values (array_unique ($ db_hosts_tmp2 ));
82+ unset($ output );
83+ unset($ db_hosts_tmp1 );
84+ unset($ db_hosts_tmp2 );
85+
86+ $ this ->database_config ["database_host " ]["options " ] = $ db_hosts ;
87+
7588 $ options = array_merge ($ options , $ this ->database_config );
7689 }
7790 return $ options ;
@@ -119,6 +132,8 @@ public function execute(array $options) {
119132 $ options ["database_name " ],
120133 $ options ["database_user " ],
121134 $ options ["database_password " ],
135+ "mysql " ,
136+ $ options ["database_host " ],
122137 )
123138 ) {
124139 $ this ->errors [] = "Error adding database " ;
0 commit comments