Apply requested changes to Config.pm

This commit is contained in:
Shay Bergmann 2021-07-26 17:11:21 +00:00
parent 4f95774ca3
commit 173ecb5d92
No known key found for this signature in database
GPG key ID: 9B31F845AB291324
3 changed files with 4 additions and 11 deletions

View file

@ -6,7 +6,6 @@ use parent 'Catalyst';
use Moose; use Moose;
use Hydra::Plugin; use Hydra::Plugin;
use Hydra::Model::DB; use Hydra::Model::DB;
use Hydra::Config;
use Catalyst::Runtime '5.70'; use Catalyst::Runtime '5.70';
use Catalyst qw/ConfigLoader use Catalyst qw/ConfigLoader
Unicode::Encoding Unicode::Encoding
@ -51,7 +50,7 @@ __PACKAGE__->config(
}, },
'Plugin::ConfigLoader' => { 'Plugin::ConfigLoader' => {
driver => { driver => {
'General' => \%configGeneralOpts 'General' => \%Hydra::Config::configGeneralOpts
} }
}, },
'Plugin::PrometheusTiny' => { 'Plugin::PrometheusTiny' => {

View file

@ -1,11 +1,5 @@
package Hydra::Config; package Hydra::Config;
use strict; our %configGeneralOpts = (-UseApacheInclude => 1, -IncludeAgain => 1, -IncludeRelative => 1);
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(%configGeneralOpts);
my %configGeneralOpts = (-UseApacheInclude => 1, -IncludeAgain => 1);
1; 1;

View file

@ -42,14 +42,14 @@ my $hydraConfig;
sub getHydraConfig { sub getHydraConfig {
return $hydraConfig if defined $hydraConfig; return $hydraConfig if defined $hydraConfig;
my $conf = $ENV{"HYDRA_CONFIG"} || (Hydra::Model::DB::getHydraPath . "/hydra.conf"); my $conf = $ENV{"HYDRA_CONFIG"} || (Hydra::Model::DB::getHydraPath . "/hydra.conf");
my %opts = (%Hydra::Config::configGeneralOpts, -ConfigFile => $conf);
if (-f $conf) { if (-f $conf) {
# Please keep these options in sync with corresponding # Please keep these options in sync with corresponding
# `Catalyst::Plugin::ConfigLoader` configuration in `Hydra.pm` # `Catalyst::Plugin::ConfigLoader` configuration in `Hydra.pm`
# This is necessary in order to maintain consistent interpretation # This is necessary in order to maintain consistent interpretation
# of the config by the various hydra components. # of the config by the various hydra components.
my %h = new Config::General( -ConfigFile => $conf my %h = new Config::General(%opts)->getall;
, %configGeneralOpts )->getall;
$hydraConfig = \%h; $hydraConfig = \%h;
} else { } else {