Fix # 48 Allow to change location of the database

This commit is contained in:
Luc Didry
2015-08-02 23:34:58 +02:00
parent e7138a40ab
commit e1840e96b0
3 changed files with 25 additions and 3 deletions
+1
View File
@@ -6,6 +6,7 @@ Revision history for Lutim
- Allow Lutim to be on a sub-directory (like http://example.org/lutim/) (#46 and #57)
- Remove deprecated (due to typo) option "provisionning".
- Allow to upload svg images (no thumbnail for now, ImageMagick in Debian Jessie don't work with svg) (#47)
- Allow to change location of the database (#48)
0.6 2014-10-03
- Add OpenGraph tags in social page (ex-twitter page)
+18 -3
View File
@@ -1,10 +1,25 @@
package LutimModel;
use Mojolicious;
use FindBin qw($Bin);
use File::Spec qw(catfile);
BEGIN {
my $m = Mojolicious->new;
our $config = $m->plugin('Config' =>
{
file => File::Spec->catfile($Bin, '..' ,'lutim.conf'),
default => {
db_path => 'lutim.db'
}
}
);
}
# Create database
use ORLite {
file => 'lutim.db',
file => $config->{db_path},
unicode => 1,
create => sub {
create => sub {
my $dbh = shift;
$dbh->do(
'CREATE TABLE lutim (
@@ -25,7 +40,7 @@ use ORLite {
height INTEGER)'
);
return 1;
}
}
};
1;
+6
View File
@@ -103,6 +103,12 @@
# optional, defaut is /
#prefix => '/',
# define a path to the SQLite database
# you can define it relative to lutim directory or set an absolute path
# remember that it has to be in a directory writable by Lutim user
# optional, default is lutim.db
#db_path => 'lutim.db',
##########################
# Lutim cron jobs settings
##########################