Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
dyndnsd-client
Commits
7554f9f4
Commit
7554f9f4
authored
Dec 29, 2017
by
Erick Hitter
Browse files
Move config to a flag
parent
918776dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
dyndnsd-client.go
View file @
7554f9f4
package
main
import
(
"flag"
"fmt"
"github.com/joshbetz/config"
"io/ioutil"
...
...
@@ -27,7 +28,17 @@ func init() {
logger
.
Println
(
"PINGING dyndnsd ENDPOINT"
)
// Configuration
cfg
=
config
.
New
(
"config.json"
)
var
configPath
string
flag
.
StringVar
(
&
configPath
,
"config"
,
""
,
"Config file path"
)
flag
.
Parse
()
if
_
,
err
:=
os
.
Stat
(
configPath
);
os
.
IsNotExist
(
err
)
{
fmt
.
Println
(
"Config path does not exist. Aborting!
\n
"
)
flag
.
Usage
()
os
.
Exit
(
3
)
}
cfg
=
config
.
New
(
configPath
)
cfg
.
Get
(
"ipv4_endpoint"
,
&
ipv4Endpoint
)
cfg
.
Get
(
"ipv6_endpoint"
,
&
ipv6Endpoint
)
}
...
...
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