mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
Merge pull request #53 from wiretrustee/handle-read-config-file-errors
Handle read config file errors
This commit is contained in:
commit
bffea0e145
@ -22,13 +22,16 @@ var (
|
||||
os.Exit(ExitSetupFailed)
|
||||
}
|
||||
|
||||
config, _ := Read(configPath)
|
||||
config, err := Read(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading config file, message: %v", err)
|
||||
}
|
||||
config.Peers = append(config.Peers, connection.Peer{
|
||||
WgPubKey: key,
|
||||
WgAllowedIps: allowedIPs,
|
||||
})
|
||||
|
||||
err := config.Write(configPath)
|
||||
err = config.Write(configPath)
|
||||
if err != nil {
|
||||
log.Errorf("failed writing config to %s: %s", config, err.Error())
|
||||
os.Exit(ExitSetupFailed)
|
||||
|
@ -17,7 +17,10 @@ var (
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
InitLog(logLevel)
|
||||
|
||||
config, _ := Read(configPath)
|
||||
config, err := Read(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading config file, message: %v", err)
|
||||
}
|
||||
|
||||
myKey, err := wgtypes.ParseKey(config.PrivateKey)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user