Last active
January 10, 2020 21:11
-
-
Save jjn1056/adc9a6e5d2c2db2e6cba2b3119971866 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package MyApp; | |
| use Moose; | |
| use Catalyst; | |
| has my_special_flag => (is=>'ro', required=>1); | |
| sub load_env { | |
| my ($target) = @_; | |
| return $ENV{"ADAMA_${target}"} || | |
| die "Missing ENV var for $target"; | |
| } | |
| __PACKAGE__->config( | |
| my_special_flag => load_env('my_special_flag'), | |
| ## and so on | |
| ); | |
| sub example :Local Args(0) { | |
| my ($self, $c) = @_; | |
| $c->res->body("Got ENV: ${\$c->my_special_flag}"); | |
| } | |
| __PACKAGE__->setup; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run with 'plackup -I. -MMyApp -e 'MyApp->psgi_app'