Skip to content
Snippets Groups Projects
Commit 0f12afef authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Cleaned up configuration of opentraffishaperd

parent 4c72dd48
No related branches found
No related tags found
No related merge requests found
...@@ -64,15 +64,11 @@ sub parseCfgCmdLine ...@@ -64,15 +64,11 @@ sub parseCfgCmdLine
my $cfg; my $cfg;
$cfg->{'config_file'} = "/etc/opentrafficshaper.conf"; $cfg->{'config_file'} = "/etc/opentrafficshaper.conf";
$cfg->{'timeout'} = 120; # $cfg->{'timeout'} = 120;
$cfg->{'background'} = "yes"; # $cfg->{'background'} = "yes";
$cfg->{'pid_file'} = "/var/run/opentrafficshaper/opentrafficshaperd.pid"; # $cfg->{'pid_file'} = "/var/run/opentrafficshaper/opentrafficshaperd.pid";
$cfg->{'log_level'} = 2; # $cfg->{'log_level'} = 2;
$cfg->{'log_file'} = "/var/log/opentrafficshaper/opentrafficshaperd.log"; # $cfg->{'log_file'} = "/var/log/opentrafficshaper/opentrafficshaperd.log";
# $server->{'host'} = "*";
# $server->{'port'} = [ 1812, 1813 ];
# $server->{'proto'} = 'udp';
# Parse command line params # Parse command line params
my $cmdline; my $cmdline;
...@@ -109,12 +105,12 @@ sub parseCfgCmdLine ...@@ -109,12 +105,12 @@ sub parseCfgCmdLine
# Pull in params for the server # Pull in params for the server
my @server_params = ( my @server_params = (
'log_level','log_file', 'log_level',#'log_file',
'host', # 'host',
'pid_file', # 'pid_file',
'user', 'group', # 'user', 'group',
'timeout', # 'timeout',
'background', # 'background',
); );
foreach my $param (@server_params) { foreach my $param (@server_params) {
$cfg->{$param} = $config{'server'}{$param} if (defined($config{'server'}{$param})); $cfg->{$param} = $config{'server'}{$param} if (defined($config{'server'}{$param}));
...@@ -135,12 +131,12 @@ sub parseCfgCmdLine ...@@ -135,12 +131,12 @@ sub parseCfgCmdLine
} }
# Loop with logging detail # Loop with logging detail
if (defined($config{'server'}{'log_detail'})) { # if (defined($config{'server'}{'log_detail'})) {
# Lets see what we have to enable # # Lets see what we have to enable
foreach my $detail (split(/[,\s;]/,$config{'server'}{'log_detail'})) { # foreach my $detail (split(/[,\s;]/,$config{'server'}{'log_detail'})) {
$cfg->{'logging'}{$detail} = 1; # $cfg->{'logging'}{$detail} = 1;
} # }
} # }
# #
# System plugins # System plugins
...@@ -161,31 +157,12 @@ sub parseCfgCmdLine ...@@ -161,31 +157,12 @@ sub parseCfgCmdLine
} }
} }
#
# Dictionary configuration
#
# Split off dictionaries to load
if (ref($config{'dictionary'}->{'load'}) eq "ARRAY") {
foreach my $dict (@{$config{'dictionary'}->{'load'}}) {
$dict =~ s/\s+//g;
# Skip comments
next if ($dict =~ /^#/);
push(@{$cfg->{'dictionary_list'}},$dict);
}
} elsif (defined($config{'dictionary'}->{'load'})) {
my @dictList = split(/\s+/,$config{'dictionary'}->{'load'});
foreach my $dict (@dictList) {
# Skip comments
next if ($dict =~ /^#/);
push(@{$cfg->{'dictionary_list'}},$dict);
}
}
# Check if the user specified a cache_file in the config # Check if the user specified a cache_file in the config
if (defined($config{'server'}{'cache_file'})) { # if (defined($config{'server'}{'cache_file'})) {
$cfg->{'cache_file'} = $config{'server'}{'cache_file'}; # $cfg->{'cache_file'} = $config{'server'}{'cache_file'};
} # }
$globals->{'file.config'} = \%config;
$globals->{'config'} = $cfg; $globals->{'config'} = $cfg;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment