2014-05-22 12:48:17 +02:00
|
|
|
library mod_dmvc;
|
|
|
|
|
|
|
|
uses
|
2018-05-15 10:32:25 +02:00
|
|
|
System.Threading,
|
2014-05-22 12:48:17 +02:00
|
|
|
Winapi.ActiveX,
|
|
|
|
System.Win.ComObj,
|
|
|
|
Web.WebBroker,
|
|
|
|
Web.ApacheApp,
|
|
|
|
Web.HTTPD24Impl,
|
2018-05-15 10:32:25 +02:00
|
|
|
MVCFramework.Logger,
|
2023-06-14 17:57:33 +02:00
|
|
|
MVCFramework.DotEnv,
|
|
|
|
MVCFramework.Commons,
|
|
|
|
Web.HTTPDMethods,
|
2018-08-05 20:31:33 +02:00
|
|
|
Winapi.Windows,
|
|
|
|
System.Classes,
|
2023-02-02 19:14:34 +01:00
|
|
|
MainDataModuleUnit in '..\WineCellarSample\winecellarserver\MainDataModuleUnit.pas' {WineCellarDataModule: TDataModule},
|
|
|
|
MainWebModuleUnit in '..\WineCellarSample\winecellarserver\MainWebModuleUnit.pas' {wm: TWebModule},
|
|
|
|
WineCellarAppControllerU in '..\WineCellarSample\winecellarserver\WineCellarAppControllerU.pas',
|
|
|
|
WinesBO in '..\WineCellarSample\winecellarserver\WinesBO.pas';
|
2014-05-22 12:48:17 +02:00
|
|
|
|
|
|
|
{$R *.res}
|
|
|
|
// httpd.conf entries:
|
|
|
|
//
|
|
|
|
(*
|
2018-05-15 10:32:25 +02:00
|
|
|
LoadModule dmvc_module modules/mod_dmvc.dll
|
2014-05-22 12:48:17 +02:00
|
|
|
|
2018-05-15 10:32:25 +02:00
|
|
|
<Location /xyz>
|
|
|
|
SetHandler mod_dmvc-handler
|
|
|
|
</Location>
|
2014-05-22 12:48:17 +02:00
|
|
|
*)
|
|
|
|
//
|
|
|
|
// These entries assume that the output directory for this project is the apache/modules directory.
|
|
|
|
//
|
|
|
|
// httpd.conf entries should be different if the project is changed in these ways:
|
2018-05-15 10:32:25 +02:00
|
|
|
// 1. The TApacheModuleData variable name is changed
|
|
|
|
// 2. The project is renamed.
|
|
|
|
// 3. The output directory is not the apache/modules directory
|
2014-05-22 12:48:17 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
// Declare exported variable so that Apache can access this module.
|
|
|
|
var
|
|
|
|
GModuleData: TApacheModuleData;
|
2018-05-15 10:32:25 +02:00
|
|
|
|
2014-05-22 12:48:17 +02:00
|
|
|
exports
|
|
|
|
GModuleData name 'dmvc_module';
|
|
|
|
|
2019-05-19 14:35:34 +02:00
|
|
|
{
|
|
|
|
Navigate to http://localhost/winecellar/
|
|
|
|
}
|
|
|
|
|
2023-06-14 17:57:33 +02:00
|
|
|
procedure RegisterLogger(const p: Pointer);
|
2014-05-22 12:48:17 +02:00
|
|
|
begin
|
2023-06-14 17:57:33 +02:00
|
|
|
dotEnv(
|
|
|
|
NewDotEnv
|
|
|
|
.WithStrategy(TMVCDotEnvPriority.FileThenEnv)
|
|
|
|
//if available, by default, loads default environment (.env)
|
|
|
|
.UseProfile('test') //if available loads the test environment (.env.test)
|
|
|
|
.UseProfile('prod') //if available loads the prod environment (.env.prod)
|
|
|
|
.UseLogger(procedure(LogItem: String)
|
|
|
|
begin
|
|
|
|
LogW('dotEnv: ' + LogItem);
|
|
|
|
end)
|
|
|
|
.Build() //uses the executable folder to look for .env* files
|
|
|
|
);
|
|
|
|
end;
|
|
|
|
|
|
|
|
begin
|
|
|
|
UseDotEnvDelegate(
|
|
|
|
function : IMVCDotEnv
|
|
|
|
begin
|
|
|
|
Result := NewDotEnv
|
|
|
|
.WithStrategy(TMVCDotEnvPriority.FileThenEnv)
|
|
|
|
//if available, by default, loads default environment (.env)
|
|
|
|
.UseProfile('test') //if available loads the test environment (.env.test)
|
|
|
|
.UseProfile('prod') //if available loads the prod environment (.env.prod)
|
|
|
|
.UseLogger(procedure(LogItem: String)
|
|
|
|
begin
|
|
|
|
LogW('dotEnv: ' + LogItem);
|
|
|
|
end)
|
|
|
|
.Build(); //uses the executable folder to look for .env* files
|
|
|
|
end);
|
2014-05-22 12:48:17 +02:00
|
|
|
CoInitFlags := COINIT_MULTITHREADED;
|
|
|
|
Web.ApacheApp.InitApplication(@GModuleData);
|
|
|
|
Application.Initialize;
|
|
|
|
Application.WebModuleClass := WebModuleClass;
|
|
|
|
Application.Run;
|
2018-05-15 10:32:25 +02:00
|
|
|
|
2014-05-22 12:48:17 +02:00
|
|
|
end.
|