summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-05-09 15:08:44 +0200
committerYorhel <git@yorhel.nl>2022-05-09 15:08:45 +0200
commitafd47ae5a1c2c7cf888acec4c64d41cf49a0a4e8 (patch)
tree39d72a9ae70f28dce841740c5541140784274556 /util
parent70b178f7a07eb8940e6c936485ae6cf60c16e35e (diff)
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.
Diffstat (limited to 'util')
-rwxr-xr-xutil/vndb.pl3
1 files changed, 3 insertions, 0 deletions
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.