| 1 |
# ABSTRACT: Role for application environment name |
| 2 |
package Dancer2::Core::Role::HasEnvironment; |
| 3 |
$Dancer2::Core::Role::HasEnvironment::VERSION = '2.2.2'; |
| 4 |
use Moo::Role; |
| 5 |
use Dancer2::Core::Types; |
| 6 |
|
| 7 |
my $DEFAULT_ENVIRONMENT = q{development}; |
| 8 |
|
| 9 |
has environment => ( |
| 10 |
is => 'ro', |
| 11 |
isa => Str, |
| 12 |
lazy => 1, |
| 13 |
builder => '_build_environment', |
| 14 |
); |
| 15 |
|
| 16 |
sub _build_environment { |
| 17 |
my ($self) = @_; |
| 18 |
return $ENV{DANCER_ENVIRONMENT} || $ENV{PLACK_ENV} || $DEFAULT_ENVIRONMENT; |
| 19 |
} |
| 20 |
|
| 21 |
1; |
| 22 |
|
| 23 |
__END__ |
| 24 |
|
| 25 |
=pod |
| 26 |
|
| 27 |
=encoding UTF-8 |
| 28 |
|
| 29 |
=head1 NAME |
| 30 |
|
| 31 |
Dancer2::Core::Role::HasEnvironment - Role for application environment name |
| 32 |
|
| 33 |
=head1 VERSION |
| 34 |
|
| 35 |
version 2.2.2 |
| 36 |
|
| 37 |
=head1 AUTHOR |
| 38 |
|
| 39 |
Dancer Core Developers |
| 40 |
|
| 41 |
=head1 COPYRIGHT AND LICENSE |
| 42 |
|
| 43 |
This software is copyright (c) 2026 by Alexis Sukrieh. |
| 44 |
|
| 45 |
This is free software; you can redistribute it and/or modify it under |
| 46 |
the same terms as the Perl 5 programming language system itself. |
| 47 |
|
| 48 |
=cut |