mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-24 00:24:06 +03:00
Single binary build (#10)
Single binary build Use go rice for embedding the static files and templates to the binary file
This commit is contained in:
parent
b741a915ae
commit
9a27cc366f
12 changed files with 169 additions and 34 deletions
|
@ -3,6 +3,7 @@ package handler
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
rice "github.com/GeertJohan/go.rice"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -429,7 +430,7 @@ func SuggestIPAllocation() echo.HandlerFunc {
|
|||
}
|
||||
|
||||
// ApplyServerConfig handler to write config file and restart Wireguard server
|
||||
func ApplyServerConfig() echo.HandlerFunc {
|
||||
func ApplyServerConfig(tmplBox *rice.Box) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
// access validation
|
||||
validSession(c)
|
||||
|
@ -453,7 +454,7 @@ func ApplyServerConfig() echo.HandlerFunc {
|
|||
}
|
||||
|
||||
// Write config file
|
||||
err = util.WriteWireGuardServerConfig(server, clients, settings)
|
||||
err = util.WriteWireGuardServerConfig(tmplBox, server, clients, settings)
|
||||
if err != nil {
|
||||
log.Error("Cannot apply server config: ", err)
|
||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, fmt.Sprintf("Cannot apply server config: %v", err)})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue