Freeside:3:Documentation:Developer/FS/Conf
From Freeside
NAME
FS::Conf - Freeside configuration values
SYNOPSIS
use FS::Conf; $conf = new FS::Conf; $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 [ HASHREF ]
- Create a new configuration object.
- HASHREF may contain options to set the configuration context. Currently accepts locale, and localeonly to disable fallback to the null locale.
- base_dir
- Returns the base directory. By default this is /usr/local/etc/freeside.
- conf KEY [ AGENTNUM [ NODEFAULT ] ]
- Returns the FS::conf record for the key and agent.
- config KEY [ AGENTNUM [ NODEFAULT ] ]
- Returns the configuration value or values (depending on context) for key. The optional agent number selects an agent specific value instead of the global default if one is present. If NODEFAULT is true only the agent specific value(s) is returned.
- config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
- Returns the exact scalar value for key.
- exists KEY [ AGENTNUM [ NODEFAULT ] ]
- 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
- key_orbase KEY SUFFIX
- If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns KEY. Useful for determining which exact configuration option is returned by config_orbase.
- invoice_templatenames
- Returns all possible invoice template names.
- touch KEY [ AGENT ];
- Creates the specified configuration key if it does not exist.
- set KEY VALUE [ AGENTNUM ];
- Sets the specified configuration key to the given value.
- set_binary KEY VALUE [ AGENTNUM ]
- Sets the specified configuration key to an exact scalar value which can be retrieved with config_binary.
- delete KEY [ AGENTNUM ];
- Deletes the specified configuration key.
- import_config_item CONFITEM DIR
Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
the database as a conf record (see L<FS::conf>). Imports from the file in the directory DIR.
- verify_config_item CONFITEM DIR
Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
the database to the legacy file value in DIR.
- config_items
- Returns all of the possible global/default configuration items as FS::ConfItem objects. See FS::ConfItem.
- invoice_from_full [ AGENTNUM ]
- Returns values of invoice_from and invoice_from_name, appropriately combined based on their current values.
SUBROUTINES
- init-config DIR
- Imports the configuration items from DIR (1.7 compatible) to conf records in the database.
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).