Make the cache directory configurable

First step to be more package friendly
master
Daniel Berteaud 10 years ago
parent 5ca9f916f6
commit 024a362944
  1. 5
      conf/settings.ini.dist
  2. 10
      templates/default/documentation.html.ep
  3. 15
      vroom.pl

@ -78,6 +78,11 @@ credentials = 'rest'
; For exmple, if you use vroom.domain.tld and pad.domain.tld, set domain.tld here ; For exmple, if you use vroom.domain.tld and pad.domain.tld, set domain.tld here
;base_domain = 'example.com' ;base_domain = 'example.com'
[directories]
; Where to store cache data. Defaults to the cache subdirectory
; User running VROOM daemon must have write access
;cache = 'cache'
[daemon] [daemon]
; IP the hypnotoad daemon will listen on. You can use * to bind on every IP/Interface ; IP the hypnotoad daemon will listen on. You can use * to bind on every IP/Interface
;listen_ip = '127.0.0.1' ;listen_ip = '127.0.0.1'

@ -400,6 +400,16 @@ cp /opt/vroom/conf/settings.ini.dist /opt/vroom/conf/settings.ini</pre>
</ul> </ul>
</p> </p>
<h3 id="settings_directories">
directories
</h3>
<p>
Controls where to find some specific directories
<ul>
<li><strong>cache</strong>: This is where VROOM will store its cache (including auto generated and compressed assets like JS and CSS bundles)</li>
</ul>
</p>
<h3 id="settings_daemon"> <h3 id="settings_daemon">
daemon daemon
</h3> </h3>

@ -21,6 +21,7 @@ use Config::Simple;
use Email::Valid; use Email::Valid;
use Protocol::SocketIO::Handshake; use Protocol::SocketIO::Handshake;
use Protocol::SocketIO::Message; use Protocol::SocketIO::Message;
use File::Path qw(make_path);
use Data::Dumper; use Data::Dumper;
app->log->level('info'); app->log->level('info');
@ -63,6 +64,16 @@ $config->{'daemon.backend'} ||= 'hypnotoad';
$config->{'daemon.log_level'} ||= 'warn'; $config->{'daemon.log_level'} ||= 'warn';
$config->{'daemon.pid_file'} ||= '/tmp/vroom.pid'; $config->{'daemon.pid_file'} ||= '/tmp/vroom.pid';
# Try to create the cache dir if they doesn't exist
foreach my $dir (qw/assets/){
if (!-d $config->{'directories.cache'} . '/' . $dir){
make_path($config->{'directories.cache'} . '/' . $dir, { mode => 0770 });
}
elsif (!-w $config->{'directories.cache'} . '/' . $dir){
die $config->{'directories.cache'} . '/' . "$dir is not writable";
}
}
# Create etherpad api client if enabled # Create etherpad api client if enabled
our $ec = undef; our $ec = undef;
if ($config->{'etherpad.uri'} =~ m/https?:\/\/.*/ && $config->{'etherpad.api_key'} ne ''){ if ($config->{'etherpad.uri'} =~ m/https?:\/\/.*/ && $config->{'etherpad.api_key'} ne ''){
@ -113,7 +124,8 @@ plugin mail => {
# Static resources compressor # Static resources compressor
plugin StaticCompressor => { plugin StaticCompressor => {
url_path_prefix => 'cache' url_path_prefix => 'assets',
file_cache_path => $config->{'directories.cache'} . '/assets/'
}; };
########################## ##########################
@ -2159,6 +2171,7 @@ get '/:room' => sub {
# use the templates defined in the config # use the templates defined in the config
push @{app->renderer->paths}, 'templates/'.$config->{'interface.template'}; push @{app->renderer->paths}, 'templates/'.$config->{'interface.template'};
# Set the secret used to sign cookies # Set the secret used to sign cookies
app->secrets([$config->{'cookie.secret'}]); app->secrets([$config->{'cookie.secret'}]);
app->sessions->secure(1); app->sessions->secure(1);

Loading…
Cancel
Save