NAME

PSA::Config - Site configuration

SYNOPSIS

# load the config file - don't process anything
my $config = PSA::Config->new;

# setup Perl and auto-detect administration options
$config->engage;

DESCRIPTION

PSA::Config provides access to the application level configuration. Currently, this is achieved via the YAML module.

CONSTRUCTOR

PSA::Config->new([$filename])

Loads the config file. The default location is etc/psa.yml, but this can be over-ridden by passing in a location.

This is basically a thin wrapper for "Load" in YAML. Note that this is not a singleton method.

OBJECT METHODS

$config->engage

This method does all the auto-configuration normally needed for most startups. This is divided between ->autoconf() and ->perlconf() methods, in order, as described below:

$config->autoconf

The purpose of autoconf() is to automatically determine, from the configuration file and current working directory, what extra configurtion options should be set.

This is discussed in terms of the current site phase. Normally, projects will use between two and four phases of development for each cycle, such as development, snapshot, preview, testing, and production. The number of phases, etc are all of course quite arbirary This is configured by defining a map;

phase_rules:
  ? '.*prd:.*/prod'
  : prod

  ? '.*prd:.*/test'
  : test

  ? '.*tst:.*/prev'
  : snap

  ? '.*:.*/dev'
  : dev

Keys in the map are strings to match against the hostname:PSA root pair. Then, all you do is add extra config data in the phases key;

phases:
  prod:
    acceptor: { nproc: 5, socket: ':6000' }
  test:
    acceptor: { nproc: 2, socket: 6001 }
  snap:
    acceptor: { nproc: 2, socket: 'var/appSocket' }
  dev:
    acceptor: { nproc: 1, socket: 'var/appSocket' }

The entire structure under each phase is copied into the root config hash. So, if the above configuration settings were made, and the application started via the psa wrapper in /abc/apps/prev on the host blahtst, then the snap phase would be automatically selected. So, it would be equivalent to setting:

acceptor:
  nproc: 2
  socket: 'var/appSocket'

(note; alternate YAML styles are showed above for brevity)

$config->perlconf

This is a general purpose method which looks for some standard options designed to configure Perl in some way, such as setting include paths.

For secure invocations of psa, this is always called after PSA::Auth (responsible for dropping privileges) has been loaded.

SEE ALSO

PSA, PSA::Intro, PSA::Installation

YAML

1 POD Error

The following errors were encountered while parsing the POD:

Around line 121:

You forgot a '=back' before '=head2'