mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-02-18 20:38:56 -06:00
71 lines
1.8 KiB
Plaintext
71 lines
1.8 KiB
Plaintext
# HortusFox launcher script
|
|
#
|
|
# This script launches a local web environment and opens the default browser with the URL of the web app.
|
|
#
|
|
# Requires AquaShell, Windows and PHP with Apache & MariaDB (e.g. XAMPP installation)
|
|
# On first start you'll need to specify your paths to httpd and mysqld.
|
|
#
|
|
|
|
require "auto";
|
|
require "fileio";
|
|
require "input";
|
|
|
|
const SERVER_PORT int <= 8000;
|
|
|
|
global project_path string;
|
|
getscriptpath project_path;
|
|
|
|
global server_url string;
|
|
set server_url <= "http://localhost";
|
|
|
|
if (%SERVER_PORT, -nt, 80) {
|
|
set server_url <= "%server_url:%SERVER_PORT";
|
|
};
|
|
|
|
global flag bool;
|
|
|
|
function create_path_file void()
|
|
{
|
|
local apache_path string;
|
|
local mysql_path string;
|
|
local tmstamp string;
|
|
local hfile int;
|
|
|
|
input apache_path "Please enter path to your httpd.exe: ";
|
|
input mysql_path "Please enter path to your mysqld.exe: ";
|
|
|
|
fmtdatetime "%F %T" tmstamp;
|
|
|
|
fopen "%project_path/paths.dnys" false hfile;
|
|
if (%hfile, -nt, %FIO_INVALID_HANDLE) {
|
|
fwriteline %hfile "# Auto-generated at %tmstamp";
|
|
fwriteline %hfile "";
|
|
fwriteline %hfile { const APACHE_PATH string <= "%apache_path"; };
|
|
fwriteline %hfile { const MYSQL_PATH string <= "%mysql_path"; };
|
|
|
|
fclose %hfile;
|
|
};
|
|
};
|
|
|
|
fexists "%project_path/paths.dnys" flag;
|
|
if (%flag, -eq, false) {
|
|
call create_path_file() => void;
|
|
};
|
|
|
|
exec "%project_path/paths.dnys";
|
|
|
|
aut_run "%APACHE_PATH/httpd.exe" "" "%APACHE_PATH" void;
|
|
aut_run "%MYSQL_PATH/mysqld" "--defaults-file=%MYSQL_PATH/my.ini --standalone" "%MYSQL_PATH" void;
|
|
|
|
aut_run "php" "asatru serve %SERVER_PORT" "%project_path" void;
|
|
aut_run "%server_url" "" "" void;
|
|
|
|
print "HortusFox is now running...";
|
|
print "Press any key to shutdown this service";
|
|
|
|
pause;
|
|
|
|
sys { taskkill /F /IM php.exe };
|
|
sys { taskkill /F /IM mysqld.exe };
|
|
sys { taskkill /F /IM httpd.exe };
|