# The configuration index is in Config::General format.
# We store it in /etc/gantry.conf (the default),
# but you don't have to.
# Everyone shares the database_server_name,
# unless their conf overrides it.
database_server_name ourdb.example.com
# This will be used by the budget application instances.
# You could also put the codes in a shared file.
# We are all about choice: your choice.
petty_cash 10
travel 30
# etc.
# The sales department uses the above codes and shares
# the dbconf available via https with the other instances
# (this has the database user name and password
# for each app).
#
# budget_sales.conf is listed first, so it takes precedence
# over everything else. It defines the database name
# and anything else unique to this instance.
ConfigureVia FlatFile Config::General /etc/gantry.d/budget_sales.conf
ConfigureVia HTTP Config::General https://confserver.example.com/dbconf
use codes
# budget_service is exactly like budget_sales, except
# it uses budget_service.conf to find its database
# name, etc.
ConfigureVia FlatFile Config::General /etc/gantry.d/budget_service.conf
ConfigureVia HTTP Config::General https://confserver.example.com/dbconf
use codes
# Someone must have liked Config::Tiny at some point,
# because this app needs it.
ConfigureVia FlatFile Config::Tiny /etc/gantry.d/phone_list.conf
ConfigureVia HTTP Config::General https://confserver.example.com/dbconf
####
#...
PerlSetVar GantryConfInstance budget_sales
####
my $conf = Gantry::Conf->retrieve( {
instance => $r->dir_config( 'GantryConfInstance' )
});
####
my $conf = Gantry::Conf->retrieve(
{
instance => $r->dir_config(
'GantryConfInstance'
),
config_file => '/etc/gantry.d/standard.conf',
}
);
####
use Getopt::Long;
my $instance = 'budget_default';
GetOptions( 'instance|i' => \$instance );
my $conf = Gantry::Conf->retrieve(
{ instance => $instance }
);