diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 56eb08d..e8d6c4f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,7 +14,27 @@ sqlite:
- local
script:
- make podcheck
- - make test-sqlite
+ - service postgresql restart
+ - sleep 10
+ - service postgresql status
+ - make create-pg-test-db
+ - MOJO_CONFIG=t/sqlite2.conf make minion &
+ - MOJO_CONFIG=t/sqlite3.conf make minion &
+ - MOJO_CONFIG=t/sqlite1.conf make test-sqlite
+ - MOJO_CONFIG=t/sqlite1.conf make watch
+ - MOJO_CONFIG=t/sqlite1.conf make cleanbdd
+ - MOJO_CONFIG=t/sqlite1.conf make cleanfiles
+ - MOJO_CONFIG=t/sqlite1.conf make stats
+ - MOJO_CONFIG=t/sqlite2.conf make test-sqlite
+ - MOJO_CONFIG=t/sqlite2.conf make watch
+ - MOJO_CONFIG=t/sqlite2.conf make cleanbdd
+ - MOJO_CONFIG=t/sqlite2.conf make cleanfiles
+ - MOJO_CONFIG=t/sqlite2.conf make stats
+ - MOJO_CONFIG=t/sqlite3.conf make test-sqlite
+ - MOJO_CONFIG=t/sqlite3.conf make watch
+ - MOJO_CONFIG=t/sqlite3.conf make cleanbdd
+ - MOJO_CONFIG=t/sqlite3.conf make cleanfiles
+ - MOJO_CONFIG=t/sqlite3.conf make stats
tags:
- Debian
- Jessie
@@ -31,7 +51,23 @@ postgresql:
- sleep 10
- service postgresql status
- make create-pg-test-db
- - make test-pg
+ - MOJO_CONFIG=t/postgresql2.conf make minion &
+ - MOJO_CONFIG=t/postgresql3.conf make minion &
+ - MOJO_CONFIG=t/postgresql1.conf make test-pg
+ - MOJO_CONFIG=t/postgresql1.conf make watch
+ - MOJO_CONFIG=t/postgresql1.conf make cleanbdd
+ - MOJO_CONFIG=t/postgresql1.conf make cleanfiles
+ - MOJO_CONFIG=t/postgresql1.conf make stats
+ - MOJO_CONFIG=t/postgresql2.conf make test-pg
+ - MOJO_CONFIG=t/postgresql2.conf make watch
+ - MOJO_CONFIG=t/postgresql2.conf make cleanbdd
+ - MOJO_CONFIG=t/postgresql2.conf make cleanfiles
+ - MOJO_CONFIG=t/postgresql2.conf make stats
+ - MOJO_CONFIG=t/postgresql3.conf make test-pg
+ - MOJO_CONFIG=t/postgresql3.conf make watch
+ - MOJO_CONFIG=t/postgresql3.conf make cleanbdd
+ - MOJO_CONFIG=t/postgresql3.conf make cleanfiles
+ - MOJO_CONFIG=t/postgresql3.conf make stats
tags:
- Debian
- - Jessie
\ No newline at end of file
+ - Jessie
diff --git a/Makefile b/Makefile
index 1931039..ea2bf9e 100644
--- a/Makefile
+++ b/Makefile
@@ -20,10 +20,10 @@ podcheck:
podchecker lib/Lutim/DB/Image.pm
test-sqlite:
- MOJO_CONFIG=t/sqlite.conf $(CARTON) $(REAL_LUTIM) test
+ $(CARTON) $(REAL_LUTIM) test
test-pg:
- MOJO_CONFIG=t/postgresql.conf $(CARTON) $(REAL_LUTIM) test
+ $(CARTON) $(REAL_LUTIM) test
test: podcheck test-sqlite test-pg
diff --git a/t/create-pg-testdb.sql b/t/create-pg-testdb.sql
index 9eacee2..323f934 100644
--- a/t/create-pg-testdb.sql
+++ b/t/create-pg-testdb.sql
@@ -1,3 +1,4 @@
CREATE USER lutim WITH PASSWORD 'lutim';
CREATE DATABASE lutimtest OWNER lutim;
CREATE DATABASE lutim_miniontest OWNER lutim;
+
diff --git a/t/postgresql1.conf b/t/postgresql1.conf
new file mode 100644
index 0000000..9d7fe63
--- /dev/null
+++ b/t/postgresql1.conf
@@ -0,0 +1,202 @@
+# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
+{
+ ####################
+ # Hypnotoad settings
+ ####################
+ # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
+ hypnotoad => {
+ # array of IP addresses and ports you want to listen to
+ listen => ['http://127.0.0.1:8080'],
+ # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1
+ # if you use Lutim directly, let it commented
+ #proxy => 1,
+ },
+
+ ################
+ # Lutim settings
+ ################
+
+ # put a way to contact you here and uncomment it
+ # mandatory
+ contact => 'John Doe, admin[at]example.com',
+
+ # random string used to encrypt cookies
+ # mandatory
+ secrets => ['fdjsofjoihrei'],
+
+ # choose a theme. See the available themes in `themes` directory
+ # optional, default is 'default'
+ #theme => 'default',
+
+ # length of the images random URL
+ # optional, default is 8
+ #length => 8,
+
+ # length of the encryption key
+ # optional, default is 8
+ #crypto_key_length => 8,
+
+ # how many URLs will be provisioned in a batch ?
+ # optional, default is 5
+ #provis_step => 5,
+
+ # max number of URLs to be provisioned
+ # optional, default is 100
+ #provisioning => 100,
+
+ # anti-flood protection delay, in seconds
+ # users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds
+ # optional, default is 5
+ #anti_flood_delay => 5,
+
+ # twitter account which will appear on twitter cards
+ # see https://dev.twitter.com/docs/cards/validation/validator to register your Lutim instance on twitter
+ # optional, default is @framasky
+ #tweet_card_via => '@framasky',
+
+ # max image size, in octets
+ # you can write it 10*1024*1024
+ # optional, default is 10485760
+ max_file_size => 1048576,
+
+ # if you want to have piwik statistics, provide a piwik image tracker
+ # only the image tracker is allowed, no javascript
+ # optional, no default
+ #piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&rec=1',
+
+ # if you want to include something in the right of the screen, put it here
+ # here's an example to put the logo of your hoster
+ # optional, no default
+ #hosted_by => 'My super hoster
',
+
+ # DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED
+ # Lutim now checks if the X-Forwarded-Proto header is present and equal to https.
+ # set to 1 if you use Lutim behind a secure web server
+ # optional, default is 0
+ #https => 0,
+
+ # broadcast_message which will displayed on all pages of Lutim (but no in json response)
+ # optional, no default
+ broadcast_message => 'test broadcast message',
+
+ # array of authorized domains for API calls.
+ # if you want to authorize everyone to use the API: ['*']
+ # optional, no domains allowed by default
+ #allowed_domains => ['http://1.example.com', 'http://2.example.com'],
+
+ # default time limit for files
+ # valid values are 0, 1, 7, 30 and 365
+ # optional, default is 0 (no limit)
+ default_delay => 30,
+
+ # number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
+ # a warning message will be displayed on homepage
+ # optional, default is 0 (no limit)
+ max_delay => 200,
+
+ # if set to 1, all the images will be encrypted and the encryption option will no be displayed
+ # optional, default is 0
+ #always_encrypt => 0,
+
+ # length of the image's delete token
+ # optional, default is 24
+ #token_length => 24,
+
+ # URL sub-directory in which you want Lutim to be accessible
+ # example: you want to have Lutim under https://example.org/lutim/
+ # => set prefix to '/lutim' or to '/lutim/', it doesn't matter
+ # optional, defaut is /
+ #prefix => '/',
+
+ # choose what database you want to use
+ # valid choices are sqlite and postgresql (all lowercase)
+ # optional, default is sqlite
+ dbtype => 'postgresql',
+
+ # SQLite ONLY - only used if dbtype is set to sqlite
+ # 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',
+
+ # PostgreSQL ONLY - only used if dbtype is set to postgresql
+ # these are the credentials to access the PostgreSQL database
+ # mandatory if you choosed postgresql as dbtype
+ pgdb => {
+ database => 'lutimtest',
+ host => 'localhost',
+ user => 'lutim',
+ pwd => 'lutim'
+ },
+
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ #minion => {
+ # enabled => 0,
+ # # Which Minion backend to use?
+ # # valid values are sqlite and postgresql (all lowercase)
+ # # mandatory if Minion is enabled, default is sqlite
+ # dbtype => 'sqlite',
+ # # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ # db_path => 'minion.db',
+ # # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # # these are the credentials to access the Minion's PostgreSQL database
+ # # mandatory if you choosed postgresql as Minion backend, no default
+ # pgdb => {
+ # database => 'lutim_minion',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ # }
+ #},
+
+ # define the height of the thumbnails generated at users' will
+ # this is not the height of the thumbnails send after upload,
+ # we're talking about thumbnails generated when someone asked for
+ # https://example.org/lutim/tesrinp?thumb
+ # this works only if you have ImageMagick
+ # optional, default is 100 (pixels)
+ #thumbnail_size => 100,
+
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
+ ##########################
+ # Lutim cron jobs settings
+ ##########################
+
+ # number of days shown in /stats page (used with script/lutim cron stats)
+ # optional, default is 365
+ #stats_day_num => 365,
+
+ # number of days senders' IP addresses are kept in database
+ # after that delay, they will be deleted from database (used with script/lutim cron cleanbdd)
+ # optional, default is 365
+ #keep_ip_during => 365,
+
+ # max size of the files directory, in octets
+ # used by script/lutim cron watch to trigger an action
+ # optional, no default
+ max_total_size => 10*1024*1024*1024,
+
+ # default action when files directory is over max_total_size (used with script/lutim cron watch)
+ # valid values are 'warn', 'stop-upload' and 'delete'
+ # please, see readme
+ # optional, default is 'warn'
+ #policy_when_full => 'warn',
+
+ # images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
+ # if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
+ # optional, no default
+ #delete_no_longer_viewed_files => 90
+};
diff --git a/t/postgresql2.conf b/t/postgresql2.conf
new file mode 100644
index 0000000..b44fb5a
--- /dev/null
+++ b/t/postgresql2.conf
@@ -0,0 +1,202 @@
+# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
+{
+ ####################
+ # Hypnotoad settings
+ ####################
+ # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
+ hypnotoad => {
+ # array of IP addresses and ports you want to listen to
+ listen => ['http://127.0.0.1:8080'],
+ # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1
+ # if you use Lutim directly, let it commented
+ #proxy => 1,
+ },
+
+ ################
+ # Lutim settings
+ ################
+
+ # put a way to contact you here and uncomment it
+ # mandatory
+ contact => 'John Doe, admin[at]example.com',
+
+ # random string used to encrypt cookies
+ # mandatory
+ secrets => ['fdjsofjoihrei'],
+
+ # choose a theme. See the available themes in `themes` directory
+ # optional, default is 'default'
+ #theme => 'default',
+
+ # length of the images random URL
+ # optional, default is 8
+ #length => 8,
+
+ # length of the encryption key
+ # optional, default is 8
+ #crypto_key_length => 8,
+
+ # how many URLs will be provisioned in a batch ?
+ # optional, default is 5
+ #provis_step => 5,
+
+ # max number of URLs to be provisioned
+ # optional, default is 100
+ #provisioning => 100,
+
+ # anti-flood protection delay, in seconds
+ # users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds
+ # optional, default is 5
+ #anti_flood_delay => 5,
+
+ # twitter account which will appear on twitter cards
+ # see https://dev.twitter.com/docs/cards/validation/validator to register your Lutim instance on twitter
+ # optional, default is @framasky
+ #tweet_card_via => '@framasky',
+
+ # max image size, in octets
+ # you can write it 10*1024*1024
+ # optional, default is 10485760
+ max_file_size => 1048576,
+
+ # if you want to have piwik statistics, provide a piwik image tracker
+ # only the image tracker is allowed, no javascript
+ # optional, no default
+ #piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&rec=1',
+
+ # if you want to include something in the right of the screen, put it here
+ # here's an example to put the logo of your hoster
+ # optional, no default
+ #hosted_by => 'My super hoster
',
+
+ # DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED
+ # Lutim now checks if the X-Forwarded-Proto header is present and equal to https.
+ # set to 1 if you use Lutim behind a secure web server
+ # optional, default is 0
+ #https => 0,
+
+ # broadcast_message which will displayed on all pages of Lutim (but no in json response)
+ # optional, no default
+ broadcast_message => 'test broadcast message',
+
+ # array of authorized domains for API calls.
+ # if you want to authorize everyone to use the API: ['*']
+ # optional, no domains allowed by default
+ #allowed_domains => ['http://1.example.com', 'http://2.example.com'],
+
+ # default time limit for files
+ # valid values are 0, 1, 7, 30 and 365
+ # optional, default is 0 (no limit)
+ default_delay => 30,
+
+ # number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
+ # a warning message will be displayed on homepage
+ # optional, default is 0 (no limit)
+ max_delay => 200,
+
+ # if set to 1, all the images will be encrypted and the encryption option will no be displayed
+ # optional, default is 0
+ #always_encrypt => 0,
+
+ # length of the image's delete token
+ # optional, default is 24
+ #token_length => 24,
+
+ # URL sub-directory in which you want Lutim to be accessible
+ # example: you want to have Lutim under https://example.org/lutim/
+ # => set prefix to '/lutim' or to '/lutim/', it doesn't matter
+ # optional, defaut is /
+ #prefix => '/',
+
+ # choose what database you want to use
+ # valid choices are sqlite and postgresql (all lowercase)
+ # optional, default is sqlite
+ dbtype => 'postgresql',
+
+ # SQLite ONLY - only used if dbtype is set to sqlite
+ # 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',
+
+ # PostgreSQL ONLY - only used if dbtype is set to postgresql
+ # these are the credentials to access the PostgreSQL database
+ # mandatory if you choosed postgresql as dbtype
+ pgdb => {
+ database => 'lutimtest',
+ host => 'localhost',
+ user => 'lutim',
+ pwd => 'lutim'
+ },
+
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ minion => {
+ enabled => 1,
+ # # Which Minion backend to use?
+ # # valid values are sqlite and postgresql (all lowercase)
+ # # mandatory if Minion is enabled, default is sqlite
+ # dbtype => 'sqlite',
+ # # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ # db_path => 'minion.db',
+ # # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # # these are the credentials to access the Minion's PostgreSQL database
+ # # mandatory if you choosed postgresql as Minion backend, no default
+ # pgdb => {
+ # database => 'lutim_minion',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ # }
+ },
+
+ # define the height of the thumbnails generated at users' will
+ # this is not the height of the thumbnails send after upload,
+ # we're talking about thumbnails generated when someone asked for
+ # https://example.org/lutim/tesrinp?thumb
+ # this works only if you have ImageMagick
+ # optional, default is 100 (pixels)
+ #thumbnail_size => 100,
+
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
+ ##########################
+ # Lutim cron jobs settings
+ ##########################
+
+ # number of days shown in /stats page (used with script/lutim cron stats)
+ # optional, default is 365
+ #stats_day_num => 365,
+
+ # number of days senders' IP addresses are kept in database
+ # after that delay, they will be deleted from database (used with script/lutim cron cleanbdd)
+ # optional, default is 365
+ #keep_ip_during => 365,
+
+ # max size of the files directory, in octets
+ # used by script/lutim cron watch to trigger an action
+ # optional, no default
+ max_total_size => 10*1024*1024*1024,
+
+ # default action when files directory is over max_total_size (used with script/lutim cron watch)
+ # valid values are 'warn', 'stop-upload' and 'delete'
+ # please, see readme
+ # optional, default is 'warn'
+ #policy_when_full => 'warn',
+
+ # images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
+ # if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
+ # optional, no default
+ #delete_no_longer_viewed_files => 90
+};
diff --git a/t/postgresql.conf b/t/postgresql3.conf
similarity index 80%
rename from t/postgresql.conf
rename to t/postgresql3.conf
index 6c63ca5..1a8d816 100644
--- a/t/postgresql.conf
+++ b/t/postgresql3.conf
@@ -130,6 +130,31 @@
pwd => 'lutim'
},
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ minion => {
+ enabled => 1,
+ # Which Minion backend to use?
+ # valid values are sqlite and postgresql (all lowercase)
+ # mandatory if Minion is enabled, default is sqlite
+ dbtype => 'postgresql',
+ # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ db_path => 'minion.db',
+ # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # these are the credentials to access the Minion's PostgreSQL database
+ # mandatory if you choosed postgresql as Minion backend, no default
+ pgdb => {
+ database => 'lutim_miniontest',
+ host => 'localhost',
+ user => 'lutim',
+ pwd => 'lutim'
+ }
+ },
+
# define the height of the thumbnails generated at users' will
# this is not the height of the thumbnails send after upload,
# we're talking about thumbnails generated when someone asked for
@@ -138,6 +163,14 @@
# optional, default is 100 (pixels)
#thumbnail_size => 100,
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
##########################
# Lutim cron jobs settings
##########################
diff --git a/t/sqlite1.conf b/t/sqlite1.conf
new file mode 100644
index 0000000..5f2b023
--- /dev/null
+++ b/t/sqlite1.conf
@@ -0,0 +1,202 @@
+# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
+{
+ ####################
+ # Hypnotoad settings
+ ####################
+ # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
+ hypnotoad => {
+ # array of IP addresses and ports you want to listen to
+ listen => ['http://127.0.0.1:8080'],
+ # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1
+ # if you use Lutim directly, let it commented
+ #proxy => 1,
+ },
+
+ ################
+ # Lutim settings
+ ################
+
+ # put a way to contact you here and uncomment it
+ # mandatory
+ contact => 'John Doe, admin[at]example.com',
+
+ # random string used to encrypt cookies
+ # mandatory
+ secrets => ['fdjsofjoihrei'],
+
+ # choose a theme. See the available themes in `themes` directory
+ # optional, default is 'default'
+ #theme => 'default',
+
+ # length of the images random URL
+ # optional, default is 8
+ #length => 8,
+
+ # length of the encryption key
+ # optional, default is 8
+ #crypto_key_length => 8,
+
+ # how many URLs will be provisioned in a batch ?
+ # optional, default is 5
+ #provis_step => 5,
+
+ # max number of URLs to be provisioned
+ # optional, default is 100
+ #provisioning => 100,
+
+ # anti-flood protection delay, in seconds
+ # users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds
+ # optional, default is 5
+ #anti_flood_delay => 5,
+
+ # twitter account which will appear on twitter cards
+ # see https://dev.twitter.com/docs/cards/validation/validator to register your Lutim instance on twitter
+ # optional, default is @framasky
+ #tweet_card_via => '@framasky',
+
+ # max image size, in octets
+ # you can write it 10*1024*1024
+ # optional, default is 10485760
+ max_file_size => 1048576,
+
+ # if you want to have piwik statistics, provide a piwik image tracker
+ # only the image tracker is allowed, no javascript
+ # optional, no default
+ #piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&rec=1',
+
+ # if you want to include something in the right of the screen, put it here
+ # here's an example to put the logo of your hoster
+ # optional, no default
+ #hosted_by => 'My super hoster
',
+
+ # DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED
+ # Lutim now checks if the X-Forwarded-Proto header is present and equal to https.
+ # set to 1 if you use Lutim behind a secure web server
+ # optional, default is 0
+ #https => 0,
+
+ # broadcast_message which will displayed on all pages of Lutim (but no in json response)
+ # optional, no default
+ broadcast_message => 'test broadcast message',
+
+ # array of authorized domains for API calls.
+ # if you want to authorize everyone to use the API: ['*']
+ # optional, no domains allowed by default
+ #allowed_domains => ['http://1.example.com', 'http://2.example.com'],
+
+ # default time limit for files
+ # valid values are 0, 1, 7, 30 and 365
+ # optional, default is 0 (no limit)
+ default_delay => 30,
+
+ # number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
+ # a warning message will be displayed on homepage
+ # optional, default is 0 (no limit)
+ max_delay => 200,
+
+ # if set to 1, all the images will be encrypted and the encryption option will no be displayed
+ # optional, default is 0
+ #always_encrypt => 0,
+
+ # length of the image's delete token
+ # optional, default is 24
+ #token_length => 24,
+
+ # URL sub-directory in which you want Lutim to be accessible
+ # example: you want to have Lutim under https://example.org/lutim/
+ # => set prefix to '/lutim' or to '/lutim/', it doesn't matter
+ # optional, defaut is /
+ #prefix => '/',
+
+ # choose what database you want to use
+ # valid choices are sqlite and postgresql (all lowercase)
+ # optional, default is sqlite
+ dbtype => 'sqlite',
+
+ # SQLite ONLY - only used if dbtype is set to sqlite
+ # 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 => 'test1.db',
+
+ # PostgreSQL ONLY - only used if dbtype is set to postgresql
+ # these are the credentials to access the PostgreSQL database
+ # mandatory if you choosed postgresql as dbtype
+ #pgdb => {
+ # database => 'lutim',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ #},
+
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ #minion => {
+ # enabled => 0,
+ # # Which Minion backend to use?
+ # # valid values are sqlite and postgresql (all lowercase)
+ # # mandatory if Minion is enabled, default is sqlite
+ # dbtype => 'sqlite',
+ # # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ # db_path => 'minion.db',
+ # # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # # these are the credentials to access the Minion's PostgreSQL database
+ # # mandatory if you choosed postgresql as Minion backend, no default
+ # pgdb => {
+ # database => 'lutim_minion',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ # }
+ #},
+
+ # define the height of the thumbnails generated at users' will
+ # this is not the height of the thumbnails send after upload,
+ # we're talking about thumbnails generated when someone asked for
+ # https://example.org/lutim/tesrinp?thumb
+ # this works only if you have ImageMagick
+ # optional, default is 100 (pixels)
+ #thumbnail_size => 100,
+
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
+ ##########################
+ # Lutim cron jobs settings
+ ##########################
+
+ # number of days shown in /stats page (used with script/lutim cron stats)
+ # optional, default is 365
+ #stats_day_num => 365,
+
+ # number of days senders' IP addresses are kept in database
+ # after that delay, they will be deleted from database (used with script/lutim cron cleanbdd)
+ # optional, default is 365
+ #keep_ip_during => 365,
+
+ # max size of the files directory, in octets
+ # used by script/lutim cron watch to trigger an action
+ # optional, no default
+ max_total_size => 10*1024*1024*1024,
+
+ # default action when files directory is over max_total_size (used with script/lutim cron watch)
+ # valid values are 'warn', 'stop-upload' and 'delete'
+ # please, see readme
+ # optional, default is 'warn'
+ #policy_when_full => 'warn',
+
+ # images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
+ # if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
+ # optional, no default
+ #delete_no_longer_viewed_files => 90
+};
diff --git a/t/sqlite2.conf b/t/sqlite2.conf
new file mode 100644
index 0000000..7071dff
--- /dev/null
+++ b/t/sqlite2.conf
@@ -0,0 +1,202 @@
+# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
+{
+ ####################
+ # Hypnotoad settings
+ ####################
+ # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
+ hypnotoad => {
+ # array of IP addresses and ports you want to listen to
+ listen => ['http://127.0.0.1:8080'],
+ # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1
+ # if you use Lutim directly, let it commented
+ #proxy => 1,
+ },
+
+ ################
+ # Lutim settings
+ ################
+
+ # put a way to contact you here and uncomment it
+ # mandatory
+ contact => 'John Doe, admin[at]example.com',
+
+ # random string used to encrypt cookies
+ # mandatory
+ secrets => ['fdjsofjoihrei'],
+
+ # choose a theme. See the available themes in `themes` directory
+ # optional, default is 'default'
+ #theme => 'default',
+
+ # length of the images random URL
+ # optional, default is 8
+ #length => 8,
+
+ # length of the encryption key
+ # optional, default is 8
+ #crypto_key_length => 8,
+
+ # how many URLs will be provisioned in a batch ?
+ # optional, default is 5
+ #provis_step => 5,
+
+ # max number of URLs to be provisioned
+ # optional, default is 100
+ #provisioning => 100,
+
+ # anti-flood protection delay, in seconds
+ # users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds
+ # optional, default is 5
+ #anti_flood_delay => 5,
+
+ # twitter account which will appear on twitter cards
+ # see https://dev.twitter.com/docs/cards/validation/validator to register your Lutim instance on twitter
+ # optional, default is @framasky
+ #tweet_card_via => '@framasky',
+
+ # max image size, in octets
+ # you can write it 10*1024*1024
+ # optional, default is 10485760
+ max_file_size => 1048576,
+
+ # if you want to have piwik statistics, provide a piwik image tracker
+ # only the image tracker is allowed, no javascript
+ # optional, no default
+ #piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&rec=1',
+
+ # if you want to include something in the right of the screen, put it here
+ # here's an example to put the logo of your hoster
+ # optional, no default
+ #hosted_by => 'My super hoster
',
+
+ # DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED
+ # Lutim now checks if the X-Forwarded-Proto header is present and equal to https.
+ # set to 1 if you use Lutim behind a secure web server
+ # optional, default is 0
+ #https => 0,
+
+ # broadcast_message which will displayed on all pages of Lutim (but no in json response)
+ # optional, no default
+ broadcast_message => 'test broadcast message',
+
+ # array of authorized domains for API calls.
+ # if you want to authorize everyone to use the API: ['*']
+ # optional, no domains allowed by default
+ #allowed_domains => ['http://1.example.com', 'http://2.example.com'],
+
+ # default time limit for files
+ # valid values are 0, 1, 7, 30 and 365
+ # optional, default is 0 (no limit)
+ default_delay => 30,
+
+ # number of days after which the images will be deleted, even if they were uploaded with "no delay" (or value superior to max_delay)
+ # a warning message will be displayed on homepage
+ # optional, default is 0 (no limit)
+ max_delay => 200,
+
+ # if set to 1, all the images will be encrypted and the encryption option will no be displayed
+ # optional, default is 0
+ #always_encrypt => 0,
+
+ # length of the image's delete token
+ # optional, default is 24
+ #token_length => 24,
+
+ # URL sub-directory in which you want Lutim to be accessible
+ # example: you want to have Lutim under https://example.org/lutim/
+ # => set prefix to '/lutim' or to '/lutim/', it doesn't matter
+ # optional, defaut is /
+ #prefix => '/',
+
+ # choose what database you want to use
+ # valid choices are sqlite and postgresql (all lowercase)
+ # optional, default is sqlite
+ dbtype => 'sqlite',
+
+ # SQLite ONLY - only used if dbtype is set to sqlite
+ # 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 => 'test2.db',
+
+ # PostgreSQL ONLY - only used if dbtype is set to postgresql
+ # these are the credentials to access the PostgreSQL database
+ # mandatory if you choosed postgresql as dbtype
+ #pgdb => {
+ # database => 'lutim',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ #},
+
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ minion => {
+ enabled => 1,
+ # # Which Minion backend to use?
+ # # valid values are sqlite and postgresql (all lowercase)
+ # # mandatory if Minion is enabled, default is sqlite
+ # dbtype => 'sqlite',
+ # # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ # db_path => 'minion.db',
+ # # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # # these are the credentials to access the Minion's PostgreSQL database
+ # # mandatory if you choosed postgresql as Minion backend, no default
+ # pgdb => {
+ # database => 'lutim_minion',
+ # host => 'localhost',
+ # #user => 'DBUSER',
+ # #pwd => 'DBPASSWORD'
+ # }
+ },
+
+ # define the height of the thumbnails generated at users' will
+ # this is not the height of the thumbnails send after upload,
+ # we're talking about thumbnails generated when someone asked for
+ # https://example.org/lutim/tesrinp?thumb
+ # this works only if you have ImageMagick
+ # optional, default is 100 (pixels)
+ #thumbnail_size => 100,
+
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
+ ##########################
+ # Lutim cron jobs settings
+ ##########################
+
+ # number of days shown in /stats page (used with script/lutim cron stats)
+ # optional, default is 365
+ #stats_day_num => 365,
+
+ # number of days senders' IP addresses are kept in database
+ # after that delay, they will be deleted from database (used with script/lutim cron cleanbdd)
+ # optional, default is 365
+ #keep_ip_during => 365,
+
+ # max size of the files directory, in octets
+ # used by script/lutim cron watch to trigger an action
+ # optional, no default
+ max_total_size => 10*1024*1024*1024,
+
+ # default action when files directory is over max_total_size (used with script/lutim cron watch)
+ # valid values are 'warn', 'stop-upload' and 'delete'
+ # please, see readme
+ # optional, default is 'warn'
+ #policy_when_full => 'warn',
+
+ # images which are not viewed since delete_no_longer_viewed_files days will be deleted by the cron cleanfiles task
+ # if delete_no_longer_viewed_files is not set, the no longer viewed files will NOT be deleted
+ # optional, no default
+ #delete_no_longer_viewed_files => 90
+};
diff --git a/t/sqlite.conf b/t/sqlite3.conf
similarity index 80%
rename from t/sqlite.conf
rename to t/sqlite3.conf
index 85b9a8b..3230469 100644
--- a/t/sqlite.conf
+++ b/t/sqlite3.conf
@@ -130,6 +130,31 @@
# #pwd => 'DBPASSWORD'
#},
+ # use Minion instead of directly increase counters
+ # need to launch a minion worker service if enabled
+ # optional, Minion is disabled by default
+ minion => {
+ enabled => 1,
+ # Which Minion backend to use?
+ # valid values are sqlite and postgresql (all lowercase)
+ # mandatory if Minion is enabled, default is sqlite
+ dbtype => 'postgresql',
+ # SQLite ONLY - only used if if you choose sqlite as Minion backend, define the path to the minion 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 minion.db
+ db_path => 'minion.db',
+ # PostgreSQL ONLY - only used if you choose postgresql as Minion backend
+ # these are the credentials to access the Minion's PostgreSQL database
+ # mandatory if you choosed postgresql as Minion backend, no default
+ pgdb => {
+ database => 'lutim_miniontest',
+ host => 'localhost',
+ user => 'lutim',
+ pwd => 'lutim'
+ }
+ },
+
# define the height of the thumbnails generated at users' will
# this is not the height of the thumbnails send after upload,
# we're talking about thumbnails generated when someone asked for
@@ -138,6 +163,14 @@
# optional, default is 100 (pixels)
#thumbnail_size => 100,
+ # maximum number of files that can be downloaded as a single zip archive
+ # if too many files are asked, it results a timeout, so Lutim split the zip URL
+ # in multiple URLs, each with max_file_size images.
+ # timeout behavior depends heavily on your server ressources (CPU) and if images
+ # are encrypted
+ # optional, default is 15
+ #max_files_in_zip => 15,
+
##########################
# Lutim cron jobs settings
##########################
diff --git a/t/test.t b/t/test.t
index 39656bc..83aee73 100644
--- a/t/test.t
+++ b/t/test.t
@@ -91,6 +91,9 @@ $t->get_ok('/d/'.$rshort.'/'.$token, form => { format => 'json' })
$t->get_ok('/'.$rshort)
->status_is(302);
+# Needed if we use Minion with sqlite for increasing counters
+sleep 8;
+
# Get image counter
$t->post_ok('/c', form => { short => $rshort, token => $token })
->status_is(200)