Skip to content
Browse files

added ability to load a yaml config file

  • Loading branch information...
1 parent e272cde commit 73ea81f990b2a11722ad303cf1c82937ad221724 @wchristian committed Aug 12, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/Web/Scenefinity.pm
View
17 lib/Web/Scenefinity.pm
@@ -16,7 +16,24 @@ use Text::Xslate;
use JSON qw' from_json to_json ';
use HTTP::Tiny;
use Data::Dumper;
+use YAML 'Load';
use List::Util qw( shuffle );
+use File::Slurp 'read_file';
+
+sub {
+ has $_ => ( is => 'lazy' ) for qw( config );
+ }
+ ->();
+
+sub config_path {
+ my $file = ".scenefinity";
+ return $file if -f $file;
+ my $home_dir = File::HomeDir->my_home || '';
+ return "$home_dir$file" if -f "$home_dir$file";
+ die "no config file found in . or ~";
+}
+
+sub _build_config { Load read_file( shift->config_path ) }
sub dispatch_request {

0 comments on commit 73ea81f

Please sign in to comment.
Something went wrong with that request. Please try again.