]> Sergey Matveev's repositories - public-inbox.git/commitdiff
daemon: require absolute cert/key paths with --daemonize
authorEric Wong <e@80x24.org>
Mon, 1 Aug 2022 21:24:44 +0000 (21:24 +0000)
committerEric Wong <e@80x24.org>
Tue, 2 Aug 2022 19:20:12 +0000 (19:20 +0000)
This is preparation for supporting loading new certs on SIGHUP.

lib/PublicInbox/Daemon.pm

index 0392d15f8578260403f89a5c3f28b481a65fced9..87a359e768d24b11698b0c239217d4324242dc38 100644 (file)
@@ -66,6 +66,7 @@ sub accept_tls_opt ($) {
                        my $host = '';
                        $path =~ s/\A([^:]+):// and $host = $1;
                        $x->{$host} = $path;
+                       check_absolute($k, $path) if $daemonize;
                }
        }
        my $ctx = IO::Socket::SSL::SSL_Context->new(%ctx_opt) or
@@ -283,6 +284,8 @@ sub daemonize () {
                check_absolute('--stdout', $stdout);
                check_absolute('--stderr', $stderr);
                check_absolute('--pid-file', $pid_file);
+               check_absolute('--cert', $default_cert);
+               check_absolute('--key', $default_key);
 
                chdir '/' or die "chdir failed: $!";
        }