Changeset df6901a5577bde9a642ac669ea6f43bae257c551 in xas-service


Ignore:
Timestamp:
12/09/16 17:15:10 (12 months ago)
Author:
Kevin L. Esteb <kevin@…>
Branches:
master
Parents:
bbf09e1ce5806b9ae4faba71a7feff8977f4606f
git-author:
Kevin L. Esteb <kevin@…> (12/09/16 17:15:10)
git-committer:
Kevin L. Esteb <kevin@…> (12/09/16 17:15:10)
Message:

working with abstracting the service

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/etc/xas-testd.ini

    r00c0cadd4c388eac9025ca9fdedfc7e341442012 rdf6901a5577bde9a642ac669ea6f43bae257c551  
    1212 
    1313[app] 
    14 base = /var/lib/xas/web 
     14root = /var/lib/xas/web/root 
    1515 
  • trunk/lib/XAS/Apps/Service/Processor.pm

    rbbf09e1ce5806b9ae4faba71a7feff8977f4606f rdf6901a5577bde9a642ac669ea6f43bae257c551  
    1515  mixin      => 'XAS::Lib::Mixins::Configs', 
    1616  utils      => 'load_module trim', 
    17   constants  => 'DELIMITER', 
    18   filesystem => 'File', 
     17  filesystem => 'File Dir', 
    1918  accessors  => 'cfg', 
    2019  vars => { 
     
    2524; 
    2625 
    27 #use Data::Dumper; 
     26use Data::Dumper; 
    2827 
    2928# ---------------------------------------------------------------------- 
     
    5756sub build_static { 
    5857    my $self = shift; 
    59     my $base = shift; 
     58    my $root = shift; 
    6059 
    6160    my $urlmap = Plack::App::URLMap->new(); 
     
    6463 
    6564    $urlmap->mount('/js' => Plack::App::File->new( 
    66         root => $base . '/root/js' ) 
     65        root => Dir($root, '/js')->path ) 
    6766    ); 
    6867 
    6968    $urlmap->mount('/css' => Plack::App::File->new( 
    70         root => $base . '/root/css') 
     69        root => Dir($root, '/css')->path ) 
    7170    ); 
    7271 
    7372    $urlmap->mount('/yaml' => Plack::App::File->new( 
    74         root => $base . '/root/yaml/yaml') 
     73        root => Dir($root, '/yaml/yaml')->path ) 
    7574    ); 
    7675 
     
    106105    # define base, name and description 
    107106 
    108     my $base = $self->cfg->val('app', 'base', '/home/kevin/dev/XAS-Service/trunk/web'); 
     107    my @paths; 
     108    my $path = Dir($self->env->lib, 'web', 'root'); 
     109    my $root = Dir($self->cfg->val('app', 'root', $path->path)); 
     110    my $base = Dir($self->cfg->val('app', 'base', $path->path)); 
    109111    my $name = $self->cfg->val('app', 'name', 'WEB Services'); 
    110112    my $description = $self->cfg->val('app', 'description', 'Test api using RESTFUL HAL-JSON'); 
    111113 
     114    push(@paths, $base->path); 
     115    push(@paths, $root->path) unless ($base eq $root); 
     116 
    112117    # Template config 
    113118 
    114119    my $config = { 
    115         INCLUDE_PATH => File($base, 'root')->path,   # or list ref 
    116         INTERPOLATE  => 1,  # expand "$var" in plain text 
     120        INCLUDE_PATH => \@paths,   # or list ref 
     121        INTERPOLATE  => 1,         # expand "$var" in plain text 
    117122    }; 
    118123 
     
    130135 
    131136    my $builder = Plack::Builder->new(); 
    132     my $urlmap  = $self->build_static($base); 
     137    my $urlmap  = $self->build_static($root); 
    133138 
    134139    $self->build_routes(\$urlmap, $base, $template, $json, $name, $description, $authen); 
Note: See TracChangeset for help on using the changeset viewer.