server.pl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env perl
  2. # Copyright (C) 2015-2016 Alex Schroeder <alex@gnu.org>
  3. # This program is free software: you can redistribute it and/or modify it under
  4. # the terms of the GNU General Public License as published by the Free Software
  5. # Foundation, either version 3 of the License, or (at your option) any later
  6. # version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this program. If not, see <http://www.gnu.org/licenses/>.
  14. use Mojolicious::Lite;
  15. # This needs to be in a different section, sometimes?
  16. plugin CGI => {
  17. support_semicolon_in_query_string => 1,
  18. };
  19. plugin CGI => {
  20. route => '/wiki',
  21. # We need this for older versions of Mojolicious::Plugin::CGI
  22. script => 'wiki.pl',
  23. run => \&OddMuse::DoWikiRequest,
  24. before => sub {
  25. no warnings;
  26. $OddMuse::RunCGI = 0;
  27. # The default data directory is determined by the environment variable
  28. # WikiDataDir and falls back to the following
  29. # $OddMuse::DataDir = '/tmp/oddmuse';
  30. use warnings;
  31. require './wiki.pl' unless defined &OddMuse::DoWikiRequest;
  32. },
  33. env => {},
  34. # path to where STDERR from cgi script goes
  35. errlog => ($ENV{WikiDataDir} || '/tmp/oddmuse')
  36. . "/wiki.log",
  37. };
  38. get '/' => sub {
  39. my $self = shift;
  40. $self->redirect_to('/wiki');
  41. };
  42. app->start;