Add configuration doc
Change provisionning option to provisioning (with back-compatibility)
This commit is contained in:
Luc Didry
2014-02-17 21:47:50 +01:00
parent cacd1a46ee
commit fcd1b1489b
3 changed files with 37 additions and 14 deletions
+22 -1
View File
@@ -27,15 +27,36 @@ After installing Carton :
```shell
git clone https://github.com/ldidry/lutim.git
cd lutim
carton install
carton install --deployment
cp lutim.conf.template lutim.conf
vi lutim.conf
```
##Configuration
* hypnotoad: listen to listen to, user and group which runs hypnotoad ;
* contact: write something which make people able to contact you (contact form URL, email address, whatever) ;
* secrets: an array of random string. Used by Mojolicious for encrypting session cookies.
* piwik\_img: the image Piwik provides you to have records of visits without javascript (better privacy than js and cookies) ;
* length: length of the random string part of image's URL (default is 8) ;
* provis\_step: LUTIm provisions random strings for image's URL per pack of `provis_step` (default is 5) ;
* provisioning: number of random strings to provision (default is 100) ;
* hosted\_by: if someone hosts your LUTIm instance, you can add some HTML (a logo for example) to make it appear on index page ;
* tweet\_card\_via: a twitter account which will appear on twitter cards ;
* max\_file\_size: well, this is explicit (default is 10Mio = 10485760 octets) ;
* https: 1 if you want to provide secure images URLs.
##Usage
```
carton exec hypnotoad script/lutim
```
##Update
```
git pull
carton install --deployment
carton exec hypnotoad script/lutim
```
Yup, that's all (Mojolicious magic), it will listen at "http://127.0.0.1:8080".
For more options (interfaces, user, etc.), change the configuration in `lutim.conf` (have a look at http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#SETTINGS for the available options).
+12 -11
View File
@@ -18,7 +18,8 @@ sub startup {
my $config = $self->plugin('Config');
# Default values
$config->{provisionning} = 100 unless (defined($config->{provisionning}));
$config->{provisioning} = 100 unless (defined($config->{provisionning}));
$config->{provisioning} = 100 unless (defined($config->{provisioning}));
$config->{provis_step} = 5 unless (defined($config->{provis_step}));
$config->{length} = 8 unless (defined($config->{length}));
@@ -61,11 +62,11 @@ sub startup {
);
$self->helper(
provisionning => sub {
provisioning => sub {
my $c = shift;
# Create some short patterns for provisionning
if (LutimModel::Lutim->count('WHERE path IS NULL') < $c->config->{provisionning}) {
# Create some short patterns for provisioning
if (LutimModel::Lutim->count('WHERE path IS NULL') < $c->config->{provisioning}) {
for (my $i = 0; $i < $c->config->{provis_step}; $i++) {
if (LutimModel->begin) {
my $short;
@@ -103,7 +104,7 @@ sub startup {
$self->defaults(layout => 'default');
$self->provisionning();
$self->provisioning();
# Router
my $r = $self->routes;
@@ -116,10 +117,10 @@ sub startup {
max_file_size => $c->req->max_message_size
);
# Check provisionning
# Check provisioning
$c->on(finish => sub {
my $c = shift;
$c->provisionning();
$c->provisioning();
$c->app->log->info('[HIT] someone visited site index');
}
);
@@ -191,9 +192,9 @@ sub startup {
$msg = $c->l('no_valid_file', $upload->filename);
}
# Check provisionning
# Check provisioning
$c->on(finish => sub {
shift->provisionning();
shift->provisioning();
}
);
@@ -262,7 +263,7 @@ sub startup {
}
if ($test != 500) {
# Update counter and check provisionning
# Update counter and check provisioning
$c->on(finish => sub {
# Log access
$c->app->log->info('[VIEW] someone viewed '.$images[0]->filename.' (path: '.$images[0]->path.')');
@@ -283,7 +284,7 @@ sub startup {
$images[0]->update(enabled => 0);
}
shift->provisionning();
shift->provisioning();
});
}
} else {
+3 -2
View File
@@ -1,4 +1,5 @@
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
# See README.md for more explanations
{
hypnotoad => {
listen => ['http://127.0.0.1:8080'],
@@ -7,10 +8,10 @@
},
contact => 'John Doe, admin[at]example.com',
secrets => ['fdjsofjoihrei'], # please provide a random string
piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&rec=1', # optional, only the piwik image tracker is allowed, no javascript
piwik_img => 'https://piwik.example.org/piwik.php?idsite=1&amp;rec=1', # optional, only the piwik image tracker is allowed, no javascript
length => 8, # optional
provis_step => 5, # optional
provisionning => 100, # optional
provisioning => 100, # optional
hosted_by => 'My super hoster <img src="http://hoster.example.com" alt="Hoster logo">', # optional
tweet_card_via => '@framasky', # optional
max_file_size => 10485760, # optional, size in octets, you can write it 10*1024*1024