Difference between revisions of "Freeside:3:Documentation:Developer/FS/Conf compat17"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
m (Edit via perl MediaWiki framework (1.13))
 
Line 1: Line 1:
 +
==NAME==
 +
FS::Conf - Freeside configuration values
  
 +
==SYNOPSIS==
 +
<code>
 +
  use FS::Conf;
 +
 +
  $conf = new FS::Conf "/config/directory";
 +
 +
  $FS::Conf::default_dir = "/config/directory";
 +
  $conf = new FS::Conf;
 +
 +
  $dir = $conf->dir;
 +
 +
  $value = $conf->config('key');
 +
  @list  = $conf->config('key');
 +
  $bool  = $conf->exists('key');
 +
 +
  $conf->touch('key');
 +
  $conf->set('key' => 'value');
 +
  $conf->delete('key');
 +
 +
  @config_items = $conf->config_items;
 +
</code>
 +
==DESCRIPTION==
 +
Read and write Freeside configuration values. Keys currently map to filenames, but this may change in the future.
 +
 +
==METHODS==
 +
; new [ DIRECTORY ]
 +
:Create a new configuration object. A directory arguement is required if $FS::Conf::default_dir has not been set.
 +
; dir
 +
:Returns the conf directory.
 +
; base_dir
 +
:Returns the base directory. By default this is /usr/local/etc/freeside.
 +
; config KEY
 +
:Returns the configuration value or values (depending on context) for key.
 +
; config_binary KEY
 +
:Returns the exact scalar value for key.
 +
; exists KEY
 +
:Returns true if the specified key exists, even if the corresponding value is undefined.
 +
; config_orbase KEY SUFFIX
 +
:Returns the configuration value or values (depending on context) for KEY_SUFFIX, if it exists, otherwise for KEY
 +
; touch KEY
 +
:Creates the specified configuration key if it does not exist.
 +
; set KEY VALUE
 +
:Sets the specified configuration key to the given value.
 +
; delete KEY
 +
:Deletes the specified configuration key.
 +
; config_items
 +
:Returns all of the possible configuration items as FS::ConfItem objects. See [[Freeside:3:Documentation:Developer/FS/ConfItem|FS::ConfItem]].
 +
 +
==BUGS==
 +
If this was more than just crud that will never be useful outside Freeside I'd worry that config_items is freeside-specific and icky.
 +
 +
==SEE ALSO==
 +
"Configuration" in the web interface (config/config.cgi).
 +
 +
httemplate/docs/config.html

Latest revision as of 05:30, 10 February 2015

NAME

FS::Conf - Freeside configuration values

SYNOPSIS

 use FS::Conf;

 $conf = new FS::Conf "/config/directory";

 $FS::Conf::default_dir = "/config/directory";
 $conf = new FS::Conf;

 $dir = $conf->dir;

 $value = $conf->config('key');
 @list  = $conf->config('key');
 $bool  = $conf->exists('key');

 $conf->touch('key');
 $conf->set('key' => 'value');
 $conf->delete('key');

 @config_items = $conf->config_items;

DESCRIPTION

Read and write Freeside configuration values. Keys currently map to filenames, but this may change in the future.

METHODS

new [ DIRECTORY ]
Create a new configuration object. A directory arguement is required if $FS::Conf::default_dir has not been set.
dir
Returns the conf directory.
base_dir
Returns the base directory. By default this is /usr/local/etc/freeside.
config KEY
Returns the configuration value or values (depending on context) for key.
config_binary KEY
Returns the exact scalar value for key.
exists KEY
Returns true if the specified key exists, even if the corresponding value is undefined.
config_orbase KEY SUFFIX
Returns the configuration value or values (depending on context) for KEY_SUFFIX, if it exists, otherwise for KEY
touch KEY
Creates the specified configuration key if it does not exist.
set KEY VALUE
Sets the specified configuration key to the given value.
delete KEY
Deletes the specified configuration key.
config_items
Returns all of the possible configuration items as FS::ConfItem objects. See FS::ConfItem.

BUGS

If this was more than just crud that will never be useful outside Freeside I'd worry that config_items is freeside-specific and icky.

SEE ALSO

"Configuration" in the web interface (config/config.cgi).

httemplate/docs/config.html