| 1 | # | ||
| 2 | # This file is part of WebDyne. | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | # Full license text is available at: | ||
| 10 | # | ||
| 11 | # <http://dev.perl.org/licenses/> | ||
| 12 | # | ||
| 13 | |||
| 14 | |||
| 15 | # | ||
| 16 | # | ||
| 17 | package WebDyne::Request::PSGI::Constant; | ||
| 18 | |||
| 19 | |||
| 20 | # Pragma | ||
| 21 | # | ||
| 22 | use strict qw(vars); | ||
| 23 | use vars qw($VERSION @ISA %Constant); | ||
| 24 | use warnings; | ||
| 25 | |||
| 26 | |||
| 27 | # Does the heavy liftying of importing into caller namespace | ||
| 28 | # | ||
| 29 | require WebDyne::Constant; | ||
| 30 | @ISA=qw(WebDyne::Constant); | ||
| 31 | |||
| 32 | |||
| 33 | # Version information | ||
| 34 | # | ||
| 35 | $VERSION='3.029'; | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | # Hash of constants | ||
| 40 | # <<< | ||
| 41 | %Constant=( | ||
| 42 | |||
| 43 | |||
| 44 | # Document Root, usually supplied as env var or command line option but | ||
| 45 | # can be set here. | ||
| 46 | # | ||
| 47 | DOCUMENT_ROOT => undef, | ||
| 48 | |||
| 49 | |||
| 50 | # Document default - will be served if exists in DOCUMENT_ROOT and no other | ||
| 51 | # file specified. | ||
| 52 | # | ||
| 53 | DOCUMENT_DEFAULT => 'app.psp', | ||
| 54 | |||
| 55 | |||
| 56 | # File to use for indexing | ||
| 57 | # | ||
| 58 | WEBDYNE_PSGI_INDEX => 'index.psp', | ||
| 59 | |||
| 60 | |||
| 61 | # Middeware config, static module. Loaded by default for convenience if | ||
| 62 | # started via webdyne.psgi script directly (i.e. not invoked by plakup | ||
| 63 | # or starman). Activate in middleware section below if wanted with plackup | ||
| 64 | # or starman | ||
| 65 | # | ||
| 66 | # Serve any static file except .psp | ||
| 67 | # | ||
| 68 | #WEBDYNE_PSGI_MIDDLEWARE_STATIC => qr{^(?!.*\.psp$).*\.\w+$}, | ||
| 69 | # | ||
| 70 | # Just common files | ||
| 71 | # | ||
| 72 | WEBDYNE_PSGI_MIDDLEWARE_STATIC => qr{\.(?:css|js|jpg|jpeg|png|gif|svg|ico|woff2?|ttf|eot|otf|webp|map|txt|inc|htm|html)$}i, | ||
| 73 | |||
| 74 | |||
| 75 | # All other middleware. Uncomment/modify as required | ||
| 76 | # | ||
| 77 | WEBDYNE_PSGI_MIDDLEWARE => [ | ||
| 78 | |||
| 79 | #{ 'Debug' => | ||
| 80 | # { panels => [ qw(Environment) ] } | ||
| 81 | #}, | ||
| 82 | |||
| 83 | # If given as a sub code ref the $DOCUMENT_ROOT is first param | ||
| 84 | # | ||
| 85 | #{ 'Static' => sub { | ||
| 86 | # { path=>qr{^(?!.*\.psp$).*\.\w+$}, root=>shift() } | ||
| 87 | #}} | ||
| 88 | |||
| 89 | ], | ||
| 90 | |||
| 91 | |||
| 92 | # Environment variables to keep, needs to be array ref | ||
| 93 | # | ||
| 94 | WEBDYNE_PSGI_ENV_KEEP => [qw(DOCUMENT_ROOT DOCUMENT_DEFAULT)], | ||
| 95 | WEBDYNE_PSGI_ENV_SET => {}, | ||
| 96 | |||
| 97 | |||
| 98 | # Warn on error ? | ||
| 99 | # | ||
| 100 | WEBDYNE_PSGI_WARN_ON_ERROR => undef, | ||
| 101 | |||
| 102 | |||
| 103 | ); | ||
| 104 | # >>> | ||
| 105 | |||
| 106 | |||
| 107 | # Done | ||
| 108 | # | ||
| 109 | 1; | ||
| 110 | __END__ |