Support configuration via environment file

Change-Id: I9c6bc5a418fce8f4c4ed2984d913032dce3042ff
diff --git a/service.go b/service.go
index 3ed40e7..6436ddd 100644
--- a/service.go
+++ b/service.go
@@ -9,6 +9,7 @@
 
 	badger "github.com/dgraph-io/badger/v3"
 	"github.com/gin-gonic/gin"
+	"github.com/joho/godotenv"
 )
 
 var db *badger.DB
@@ -76,13 +77,18 @@
 	r := gin.Default()
 	r.LoadHTMLGlob("templates/*")
 
+	korapServer := os.Getenv("KORAP_SERVER")
+	if korapServer == "" {
+		korapServer = "https://korap.ids-mannheim.de"
+	}
+
 	//
 	r.GET("/", func(c *gin.Context) {
 		c.Header("Access-Control-Allow-Origin", "null")
 		c.Header("Access-Control-Allow-Credentials", "null")
 		c.Header("Vary", "Origin")
 		c.HTML(http.StatusOK, "main.html", gin.H{
-			"korapServer": "https://korap.ids-mannheim.de/instance/test",
+			"korapServer": korapServer,
 		})
 	})
 
@@ -93,6 +99,8 @@
 }
 
 func main() {
+	godotenv.Load()
+
 	initDB("db")
 	defer closeDB()
 
@@ -139,5 +147,11 @@
 		return
 	}
 	r := setupRouter()
-	log.Fatal(http.ListenAndServe(":5722", r))
+
+	port := os.Getenv("PORT")
+	if port == "" {
+		port = "5722"
+	}
+
+	log.Fatal(http.ListenAndServe(":"+port, r))
 }