Skip to content

Commit 516f28c

Browse files
committed
Add a docs note about app symbol being available in configs
1 parent 5825646 commit 516f28c

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

lib/Thunderhorse.pm

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,25 @@ are loaded in order:
10251025
10261026
=back
10271027
1028-
Where C<$ext> is any extension handled by available config readers (C<.pl> for
1029-
Perl scripts by default), and C<$env> is the current environment (production,
1030-
development, or test). The environment can be set via the C<PAGI_ENV>
1031-
environment variable or the C<env> constructor parameter. C<pagi-server -E
1032-
production> also sets C<PAGI_ENV>.
1028+
Where C<$ext> is any extension handled by available config readers, and C<$env>
1029+
is the current environment (production, development, or test). The environment
1030+
can be set via the C<PAGI_ENV> environment variable or the C<env> constructor
1031+
parameter. C<pagi-server -E production> also sets C<PAGI_ENV>.
1032+
1033+
By default, configuration is gathered from perl files with C<.pl> extension.
1034+
These files should yield a hash reference with configuration keys. To use an
1035+
alternative type of configuration files, L<Gears::App/config> should be
1036+
provided as a constructor argument, or declared in the application class. Perl
1037+
files allow additional symbols to be declared in them (as subroutines), and by
1038+
default C<app> symbol is declared, allowing you to easily provide complex data
1039+
in your configuration:
1040+
1041+
# conf/config.pl
1042+
{
1043+
# a custom configuration key, calling custom method from your
1044+
# application class
1045+
system_info => app->get_system_info,
1046+
}
10331047
10341048
Configuration files are merged together, with environment-specific settings
10351049
overriding base settings. Example structure:

0 commit comments

Comments
 (0)