NAME
Lavoco::Web::Editor - FastCGI app to edit flat-files.
VERSION
Version 0.07
SYNOPSIS
This application was originally designed to aid in the editing of basic templates for a Lavoco::Web::App project.
use Lavoco::Web::Editor;
my $editor = Lavoco::Web::Editor->new;
my $action = lc( $ARGV[0] ); # (start|stop|restart)
$editor->$action;
METHODS
Class Methods
new
Creates a new instance of the editor object.
Attributes
processes
Number of FastCGI process to spawn, 5 by default.
filename
Filename for the config file, default is editor.json
and only JSON is currently supported.
config
The loaded config as a hash-reference.
Instance Methods
start
Starts the FastCGI daemon. Performs basic checks of your environment and config, dies if there's a problem.
stop
Stops the FastCGI daemon.
restart
Restarts the FastCGI daemon, with a 1 second delay between stopping and starting.
CONFIGURATION
The editor app should be a simple Perl script in a folder with the following structure:
editor.pl # see the synopsis
editor.json # config, see below
editor.pid # generated, to control the process
editor.sock # generated, to accept incoming FastCGI connections
logs/
The config file is read for each and every request, so you can reasonably enable editing of the editors own config file.
See the examples
directory for a sample JSON config file, similar to the following...
{
"files" : [
"app.json",
"site/style.css"
],
"folders" : [
"templates/content/organic",
"templates/content/store"
],
"uploads" : [
"site/images"
],
"password" : "foo",
"salt" : "abc123"
}
Three fields which drive the editor are files
, folders
and uploads
, each of which is an array of paths, all relative to the base directory of the editor script.
Files in the files
list are editable, but the editor can not create new files in their respective containing directories.
All visible files in the folders
are editable, but not sub-directories, you need to add those separately. The editor can also create new files in each folder.
The editor can upload files into any of the uploads
folders.
If there is a defined password
in the config, then this will be requested before a user can access the index page (listing all files that can be edited).
When using a password
, a salt
is also required, just create a random string, it's simply concatenated to the password before SHA-hashing and setting as a cookie.
TODO
Allow absolute paths to any part of the filesystem?
AUTHOR
Rob Brown, <rob at intelcompute.com>
LICENSE AND COPYRIGHT
Copyright 2015 Rob Brown.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.