Freeside:1.7:Documentation:Developer/FS/Conf

From Freeside
Jump to: navigation, search

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).