]> git.xolatile.top Git - gorillanest.git/commitdiff
Optional Socketing & Redundant config.pl
authorEmil Williams <emilemilemil@cock.li>
Thu, 21 Aug 2025 00:12:20 +0000 (00:12 +0000)
committerEmil Williams <emilemilemil@cock.li>
Thu, 21 Aug 2025 00:12:20 +0000 (00:12 +0000)
config.default.pl [new file with mode: 0644]
config.pl.default [deleted file]
gorillanest.pl.cgi
gorillanest.pl.fcgi

diff --git a/config.default.pl b/config.default.pl
new file mode 100644 (file)
index 0000000..b95d005
--- /dev/null
@@ -0,0 +1,15 @@
+# always assume anything to do with files is from project root
+
+use constant LOG_FILE => '/tmp/gorillanest.log';
+use constant SOCKET_FILE => '/tmp/gorillanest.socket';
+use constant DB_FILE => 'gorillanest.sqlite3'; # sqlite3
+
+use constant TEMPLATE_ROOT => 'template'; # template directory
+use constant GIT_ROOT => 'git'; # git directory (~user/repo)
+
+# If you're using lighttpd, set this to 1
+# This disables SOCKET_FILE and lets the socket handling be externally managed
+use constant BARE_REQUEST => 0;
+
+use constant SOCKET_MAX_CONNECTIONS => 100;
+1;
diff --git a/config.pl.default b/config.pl.default
deleted file mode 100644 (file)
index c6becdf..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# always assume anything to do with files is from project root
-use constant LOG_FILE => '/tmp/gorillanest.log';
-use constant GIT_ROOT => 'git'; # directory containing all browsable $users/$repositories
-use constant DB_FILE => 'gorillanest.sqlite3'; # sqlite3 database file location
-use constant TEMPLATE_ROOT => 'template'; # template directory
-use constant USER_REPOSITORY => qr{^/([a-zA-Z0-9_.]+)(?:/([a-zA-Z0-9_.]+))?}; # $1 = username, $2 = repository fullname
-1;
index 6d01d7c16fe94455012fa6634b67eca22ebd6b88..cebe11b1676952121956cae46294735446cb88d5 100755 (executable)
@@ -21,6 +21,7 @@ use Data::Dumper;
 use Git::Repository;
 
 use lib '.';
+BEGIN { require 'config.default.pl'; }
 BEGIN { require 'config.pl'; }
 
 sub info {
index a9d77c0f2fa68140c93e8f1a46ee68d61ff2fce3..7dc343f31542aa5f7f3ac1057e4b1659e073c7aa 100755 (executable)
@@ -11,8 +11,7 @@ BEGIN { require 'gorillanest.pl.cgi'; }
 
 try {
     open STDERR, '>', LOG_FILE or die LOG_FILE . ": $!";
-    my $sock = FCGI::OpenSocket(SOCKET_FILE, 100);
-    my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock);
+    my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, BARE_REQUEST ? 0 : FCGI::OpenSocket(SOCKET_FILE, SOCKET_MAX_CONNECTIONS));
     while($request->Accept() >= 0) {
                master();
     }