Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nigel Kukard
smradius
Commits
cf9de38c
Commit
cf9de38c
authored
Sep 12, 2016
by
Nigel Kukard
Browse files
Pull params from function args over commandline
parent
e7062618
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/smradius/daemon.pm
View file @
cf9de38c
...
...
@@ -57,7 +57,7 @@ eval qq{
}
;
## use critic
use
Getopt::
Long
;
use
Getopt::
Long
qw( GetOptionsFromArray )
;
use
Socket
;
use
Sys::
Syslog
;
use
Time::
HiRes
qw( gettimeofday tv_interval )
;
...
...
@@ -113,16 +113,23 @@ sub configure {
$server
->
{'
max_servers
'}
=
25
;
$server
->
{'
max_requests
'}
=
1000
;
# Work out runtime arguments
my
@runArgs
=
@
{
$server
->
{'
_run_args
'}}
?
@
{
$server
->
{'
_run_args
'}}
:
@ARGV
;
# Parse command line params
my
$cmdline
;
%
{
$cmdline
}
=
();
GetOptions
(
if
(
!
GetOptionsFromArray
(
\
@runArgs
,
\
%
{
$cmdline
},
"
help
",
"
config:s
",
"
debug
",
"
fg
",
)
or
die
"
Error parsing commandline arguments
";
))
{
print
(
STDERR
"
ERROR: Error parsing commandline arguments
");
return
1
;
}
# Check for some args
if
(
$cmdline
->
{'
help
'})
{
...
...
@@ -343,7 +350,7 @@ sub post_configure_hook {
my
$config
=
$self
->
{'
config
'};
$self
->
log
(
LOG_NOTICE
,"
[SMRADIUS] SMRadius - v
"
.
VERSION
);
$self
->
log
(
LOG_NOTICE
,"
[SMRADIUS] SMRadius - v
$
VERSION
"
);
# Init config
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] Initializing configuration...
");
...
...
@@ -1320,7 +1327,7 @@ sub log ## no critic (Subroutines::ProhibitBuiltinHomonyms)
# Display help
sub
displayHelp
{
print
(
STDERR
"
SMRadius v
"
.
VERSION
.
"
- Copyright (c) 2007-2016, AllWorldIT
\n
");
print
(
STDERR
"
SMRadius v
$
VERSION
- Copyright (c) 2007-2016, AllWorldIT
\n
");
print
(
STDERR
<<
EOF
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment