From afd47ae5a1c2c7cf888acec4c64d41cf49a0a4e8 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 9 May 2022 15:08:44 +0200 Subject: Implement site-wide read-only mode Somewhat surprising I haven't implemented this earlier, I'm sure it might have been useful during server migrations. Anyway, with my current plans for a postgres 14 upgrade I could significantly reduce full downtime by temporarily putting the site in read-only mode instead. --- util/vndb.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util') diff --git a/util/vndb.pl b/util/vndb.pl index b46d409a..3c0be0c2 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -25,6 +25,9 @@ use VNWeb::Validation (); use VNWeb::LangPref (); TUWF::set %{ config->{tuwf} }; +TUWF::set db_login => sub { + DBI->connect(config->{tuwf}{db_login}->@*, { PrintError => 0, RaiseError => 1, AutoCommit => 0, pg_enable_utf8 => 1, ReadOnly => 1 }) +} if config->{read_only}; # Signal to VNWeb::Elm whether it should generate the Elm files. # Should be done before loading any more modules. -- cgit v1.2.3