aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Williams2025-08-21 00:12:20 +0000
committerEmil Williams2025-08-21 00:12:20 +0000
commitd5c3ef85f9324b81a179284fedf02e1658a7620a (patch)
tree21d639f551200e771f88db53a2bbe2cefce2ae8b
parent33c7281c610623e84985bd1104236167a1ca06c7 (diff)
downloadgorillanest-d5c3ef85f9324b81a179284fedf02e1658a7620a.tar.xz
gorillanest-d5c3ef85f9324b81a179284fedf02e1658a7620a.tar.zst
Optional Socketing & Redundant config.pl
-rw-r--r--config.default.pl15
-rw-r--r--config.pl.default7
-rwxr-xr-xgorillanest.pl.cgi1
-rwxr-xr-xgorillanest.pl.fcgi3
4 files changed, 17 insertions, 9 deletions
diff --git a/config.default.pl b/config.default.pl
new file mode 100644
index 0000000..b95d005
--- /dev/null
+++ b/config.default.pl
@@ -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
index c6becdf..0000000
--- a/config.pl.default
+++ /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;
diff --git a/gorillanest.pl.cgi b/gorillanest.pl.cgi
index 6d01d7c..cebe11b 100755
--- a/gorillanest.pl.cgi
+++ b/gorillanest.pl.cgi
@@ -21,6 +21,7 @@ use Data::Dumper;
use Git::Repository;
use lib '.';
+BEGIN { require 'config.default.pl'; }
BEGIN { require 'config.pl'; }
sub info {
diff --git a/gorillanest.pl.fcgi b/gorillanest.pl.fcgi
index a9d77c0..7dc343f 100755
--- a/gorillanest.pl.fcgi
+++ b/gorillanest.pl.fcgi
@@ -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();
}