From fe2ee4503299a59b2ea87a957affbedafa9e1d48 Mon Sep 17 00:00:00 2001
From: vx3r <vx3r@127-0-0-1.fr>
Date: Thu, 20 Feb 2020 11:08:47 +0900
Subject: [PATCH] issue #11 bug, introduced earlier
 0aad10cb63df40ef1ded5baac76ac7503ca52399

---
 main.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/main.go b/main.go
index 0f00676..4efc003 100644
--- a/main.go
+++ b/main.go
@@ -41,6 +41,16 @@ func main() {
 		}
 	}
 
+	// check if server.json exists otherwise create it
+	if !util.FileExists(filepath.Join(os.Getenv("WG_CONF_DIR"), "server.json")) {
+		_, err = core.ReadServer()
+		if err != nil {
+			log.WithFields(log.Fields{
+				"err": err,
+			}).Fatal("server.json doesnt not exists and can not read it")
+		}
+	}
+
 	if os.Getenv("GIN_MODE") == "debug" {
 		// set gin release debug
 		gin.SetMode(gin.DebugMode)
-- 
GitLab