Config

Description

Finds the etc directory and reads the Assure1.conf file in JSON format.

Synopsis

my $config = new Assure1::Config();

# Find the path to an application
my $RunScript = $config->{BaseDir} . '/bin/RunScript';

# Save Event DB shard ID
$config->{DBShards}->{Event} = 3;

# Use a non-standard config file
my $config = Assure1::Config->new({ 'configPath' => '/path/to/Assure1-custom.conf' });

Notes

Using the 'configPath' option will cause all further Assure1::Config instantiations to use that configPath as the default for the life of the process.

For example:

# will read in BASEDIR/etc/Assure1.conf
my $config1 = Assure1::Config->new();

# will read in /path/to/Assure1-custom.conf
my $config2 = Assure1::Config->new({ 'configPath' => '/path/to/Assure1-custom.conf' });

# will read in /path/to/Assure1-custom.conf because of custom configPath set for $config2 above
my $config3 = Assure1::Config->new();

# will read in /path/to/Assure1-another-custom.conf
my $config4 = Assure1::Config->new({ 'configPath' => '/path/to/Assure1-another-custom.conf' });