Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Last active January 10, 2020 21:11
Show Gist options
  • Save jjn1056/adc9a6e5d2c2db2e6cba2b3119971866 to your computer and use it in GitHub Desktop.
Save jjn1056/adc9a6e5d2c2db2e6cba2b3119971866 to your computer and use it in GitHub Desktop.
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;
@jjn1056
Copy link
Author

jjn1056 commented Jan 10, 2020

run with 'plackup -I. -MMyApp -e 'MyApp->psgi_app'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment