forked from lix-project/hydra
Factor out common options
This commit is contained in:
parent
3c621ec386
commit
4f95774ca3
|
@ -6,6 +6,7 @@ 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
|
||||||
|
@ -50,15 +51,7 @@ __PACKAGE__->config(
|
||||||
},
|
},
|
||||||
'Plugin::ConfigLoader' => {
|
'Plugin::ConfigLoader' => {
|
||||||
driver => {
|
driver => {
|
||||||
'General' => {
|
'General' => \%configGeneralOpts
|
||||||
# Please keep these options in sync with corresponding
|
|
||||||
# call to `new Config::General` in `getHydraConfig()` sub
|
|
||||||
# in `Hydra/Helper/Nix.pm`. This is necessary in order to
|
|
||||||
# maintain consistent interpretation of the config by the
|
|
||||||
# various hydra components.
|
|
||||||
-UseApacheInclude => 1,
|
|
||||||
-IncludeAgain => 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Plugin::PrometheusTiny' => {
|
'Plugin::PrometheusTiny' => {
|
||||||
|
|
11
src/lib/Hydra/Config.pm
Normal file
11
src/lib/Hydra/Config.pm
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package Hydra::Config;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Exporter;
|
||||||
|
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT = qw(%configGeneralOpts);
|
||||||
|
|
||||||
|
my %configGeneralOpts = (-UseApacheInclude => 1, -IncludeAgain => 1);
|
||||||
|
|
||||||
|
1;
|
|
@ -5,6 +5,7 @@ use Exporter;
|
||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use Config::General;
|
use Config::General;
|
||||||
|
use Hydra::Config;
|
||||||
use Hydra::Helper::CatalystUtils;
|
use Hydra::Helper::CatalystUtils;
|
||||||
use Hydra::Model::DB;
|
use Hydra::Model::DB;
|
||||||
use Nix::Store;
|
use Nix::Store;
|
||||||
|
@ -48,9 +49,7 @@ sub getHydraConfig {
|
||||||
# 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( -ConfigFile => $conf
|
||||||
, -UseApacheInclude => 1
|
, %configGeneralOpts )->getall;
|
||||||
, -IncludeAgain => 1
|
|
||||||
)->getall;
|
|
||||||
|
|
||||||
$hydraConfig = \%h;
|
$hydraConfig = \%h;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue