aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-09-26 16:37:40 +0100
committerDave Arter <davea@mysociety.org>2018-09-28 16:19:47 +0100
commit561e01b9b51b62e2566d80cd63d308f9a4f82822 (patch)
treea5f5a9254e3c3f1536a7300b45582ad2ceae51d8 /perllib/FixMyStreet/App.pm
parent9b2b8675f6dfa22c45d609349f97730a33c975d3 (diff)
Factor out photo storage backend init checks
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm17
1 files changed, 4 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index afc8bd918..051308920 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -10,6 +10,7 @@ use Memcached;
use FixMyStreet::Map;
use FixMyStreet::Email;
use FixMyStreet::Email::Sender;
+use FixMyStreet::PhotoStorage;
use Utils;
use Path::Tiny 'path';
@@ -128,19 +129,9 @@ after 'prepare_headers' => sub {
__PACKAGE__->log->disable('debug') #
unless __PACKAGE__->debug;
-# Check upload_dir
-# TODO: Should this check be part of PhotoStorage::FileSystem?
-if (
- FixMyStreet->config('PHOTO_STORAGE_BACKEND') eq 'FileSystem' ||
- !defined FixMyStreet->config('PHOTO_STORAGE_BACKEND') # Backwards compatibility
- ) {
- my $cache_dir = FixMyStreet->config('PHOTO_STORAGE_OPTIONS')->{UPLOAD_DIR}
- || FixMyStreet->config('UPLOAD_DIR');
- $cache_dir = path($cache_dir)->absolute(FixMyStreet->path_to());
- $cache_dir->mkpath;
- unless ( -d $cache_dir && -w $cache_dir ) {
- warn "\x1b[31mCan't find/write to photo cache directory '$cache_dir'\x1b[0m\n";
- }
+# Set up photo storage
+unless ( FixMyStreet::PhotoStorage::backend->init() ) {
+ warn "\x1b[31mCan't set up photo storage backend\x1b[0m\n";
}
=head1 NAME
ng.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# systemd tty-file, haxed for autologin
# needs agetty
# Tech:server

[Unit]
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# On systems without virtual consoles, don't start any getty. (Note
# that serial gettys are covered by serial-getty@.service, not this
# unit
ConditionPathExists=/dev/tty0

[Service]
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/agetty --autologin lol %I 38400
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP

[Install]
Alias=getty.target.wants/getty@tty1.service