The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Solstice::Configure - Provides configuration info to the Solstice Framework

SYNOPSIS

  use Solstice::Configure;
  
  my $config = Solstice::Configure->new();
  
  # This creates a new configation object.  The first time this happens,
  # Solstice::Configure attempts to locate the central Solstice configuration file,
  # and then to locate the config files for all installed applications.  This
  # happens automatically when Solstice is used as an Apache handler, but when
  # writing scripts, you may notice a delay as modules are loaded to parse and
  # handle all the application config files.
  
  my $config = Solstice::Configure->new('WebQ');
  $config->setSection('RRef');
  
  # Normally, access is given only to the central config keys, but when
  # Solstice::Configure is given an application name (namespace) the keys defined
  # in that app's config file are availble. This can be done either at the
  # constructor or with setSection().
  
  my $value = $config->get('KEY');
  
  # This retrieves the key specified in the config file.  If no namespace was
  # provided, it only searches the central config file.  otherwise it searches
  # the app-specfic config first and then the central one.
  
  # Required configuration directives are offered via accessor:
  
  # Central Solstice configuration:
  $value = $config->getRoot();                #solstice filesystem root
  $value = $config->getVirtualRoot();            #Solstice URL root
  $value = $config->getURL();                    #synonmy for getVirtualRoot()
  $value = $config->getServerString();        #A string identfying the server
  $value = $config->getAdminEmail();            #backend email - not shown to user
  $value = $config->getSupportEmail();        #public email - shown to user
  $value = $config->getDBName();              #Database Name
  $value = $config->getDBHost();                #Database Host
  $value = $config->getDBPort();                #database port
  $value = $config->getDBUser();                #Database login user
  $value = $config->getDBPassword();            #Database password
  $value = $config->getEncryptionKey();        #Key to use for encryption
  $value = $config->getBoilerplateView();        #View module to use to paint boilerplate
  $value = $config->getAppDirs();                #List of paths where apps may live
  $value = $config->getNamespaces();            #List of all the app namespaces that were loaded
  
  # Shared directives - legal in both Solstice and application configs
  $value = $config->getCSSFiles();            #List of css files to include 
  $value = $config->getJSFiles();                #List of js files to include
  $value = $config->getStaticDirs();            #List of image/static content dirs to allow
  $value = $config->getCGIUrls();                #list of non-framework cgis to allow
  
  # Application-only directives
  $value = $config->getAppRoot();                #filesystem location of app
  $value = $config->getAppVirtualRoot();        #URL of app, relative to solstice virtual root
  $value = $config->getAppURL();                #synonym for getAppVirtualRoot
  $value = $config->getAppUrls();                #URLS handled by this app, relative to app URL
  $value = $config->getStartupFiles();        #List of startup files to run
  $value = $config->getErrorHandler();        #class used to handle errors in the app

DESCRIPTION

Solstice::Configure is used to provide configuration data to applications, and the solstice framework as a whole.

The central Solstice configuation file must be named "solstice_config.xml" and should be located either in the directory specified in the environment variable SOLSTICE_CONFIG_PATH, in the root of the solstice install, or in the /conf/ directory within the solstice install. If the ENV variable is not set, the Solstice /functions/ dir must be in Perl's @INC list for the config file to be found.

Application config files must be named "config.xml" and must be placed at the root of the application folder, as specified in the application layout.

An example Solstice config file and an example application config file can be found in the Solstice /conf/ directory.

_generateDefaultSolsticeConfigValues()

This is used when the example_solstice_config hasn't been copied to the solstice_config yet... this creates enough values for the screens to get up and running.

_configParsed(PATH_TO_CONFIG)

Marks a configuration file as having been parsed, at the current time. This time is checked against the modification date of the config file during processing by _requiresParsing(PATH_TO_CONFIG)

_requiresParsing(PATH_TO_CONFIG)

This is the gatekeeper for each config file's parsing. If the file hasn't been parsed yet, or if the file has been modified since the last time it was parsed, this will let a new parsing run happen. Otherwise, this will return false, preventing an unneccesary parse.

getDBSlave

Returns a hash that contains all the information about a database slave (returns this at random)

setDevelopmentMode()

This should only be called from tests, where development modes need to be tested programatically instead of being read from a config file.

_addDBHosts($namespace_tag, $array_of_hashrefs)
_addConfigurationKeys($namespace_tag, $hashref_of_keys)
_addRemoteDefinitions($namespace_tag, $hashref_of_keys)
setSection($section)

Set the header in the config file we will be reading from, besides STANDARD.

getRoot ()

Finds the directory that holds the site's Solstice install.

_getClassName()

Return the class name. Overridden to avoid a ref() in the superclass.

COPYRIGHT

Copyright 1998-2007 Office of Learning Technologies, University of Washington

Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.