NAME

Smolder::Conf - Smolder configuration module

SYNOPSIS

# all configuration directives are available as exported subs
use Smolder::Conf qw(Secret Port);
$secret = Secret;

# you can also call get() in Smolder::Conf directly
$port = Smolder::Conf->get("Port");

# or you can access them as methods in the Smolder::Conf module
$port = Smolder::Conf->Port;

# give Smolder::Conf some values to override the defaults
Smolder::Conf->init(
    Secret   => '1Adxd23023s',
    Port     => 80,
    HostName => 'smolder.myorg.com',
    LogFile  => '/path/to/logs',
);

# pull the conf values from a file
Smolder::Conf->init_from_file('/path/to/conf/file');

DESCRIPTION

This module provides access to the configuration settings in smolder.conf. Smolder tries to have reasonable defaults but they can be overridden when needed.

OPTIONS

The following configuration options are available:

Port

Port on which Smolder should listen.

Default: 8080

HostName

Host name to listen to.

Default: localhost.localdomain.

FromAddress

Email address from which reports should be sent.

Default: smolder@localhost.localdomain

SMTPHost

Hostname through which SMTP mail should be sent.

Default: localhost.localdomain

LogFile

Log file to write to.

Default: none

LogLevel

The level at which things will start to be logged. Only used if LogFile is set.

Default: warning

PidFile

File in which to write the PID of the Smolder process. A PidFile is required for smolderctl to work.

Default: none

TemplateDir

Source of Smolder's templates.

Default: templates in the share directory

DataDir

Directory for all Smolder's stored data.

Default: .smolder in the user's home directory

HtdocsDir

Smolder's HTML documents directory.

Default: htdocs in the share directory

SQLDir

Smolder's SQL directory.

Default: sql in the share directory

Secret

XXX

Default: XXX

AutoRefreshReports

XXX

Default: 0

TruncateTestFilenames

XXX

Default: 0

ErrorsToScreen

XXX

Default: 0

ReportsPerPage

Number of reports to show per Smolder web screen.

Default: 5

AutoRedirectToProject

XXX

Default: 0

METHODS

init

Override the configuration defaults by providing named-value pairs:

Smolder::Conf->init(
    Secret   => '1Adxd23023s',
    Port     => 80,
    HostName => 'smolder.myorg.com',
    LogFile  => '/path/to/logs',
);

init_from_file

Override the configuration defaults by providing a file. Config files are simple lists of name-values pairs. One pair per-line and each name/value is separated by whitespace:

HostName    smolder.test
DataDir     /var/lib/smolder/
Port        80
FromAddress smolder@smolder.test
TemplateDir /var/share/smolder/templates
HtdocsDir   /var/share/smolder/htdocs
SQLDir      /var/share/smolder/sql

get

Given a directive name, returns the value (which may be a list) of a configuration directive. Directive names are case-insensitive.

$value = Smolder::Conf->get('DirectiveName');

test_data_dir

The directory path for test data directory for this copy of Smolder

ACCESSOR METHODS

All configuration directives can be accessed as methods themselves.

my $port = Smolder::Conf->port();

Gets the value of a directive using an autoloaded method. Directive names are case-insensitive.

EXPORTING DIRECTIVES

Each configuration directive can also be accessed as an exported subroutine.

use Smolder::Conf qw(port FromAddress);
...
my $port = port();
my $from = FromAddress();

Directive names are case-insensitive. Gets the value of a variable using an exported, autoloaded method. Case-insensitive.