Add broken flag

This commit is contained in:
n0vad3v 2020-02-23 20:44:06 +08:00
parent e45ca996ac
commit a302eeddc0
No known key found for this signature in database
GPG Key ID: 8D42A0E699E50639

View File

@ -3,9 +3,8 @@ package main
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"flag"
"fmt" "fmt"
"github.com/chai2010/webp"
"github.com/gofiber/fiber"
"image" "image"
"image/jpeg" "image/jpeg"
"image/png" "image/png"
@ -15,6 +14,9 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"github.com/chai2010/webp"
"github.com/gofiber/fiber"
) )
type Config struct { type Config struct {
@ -51,7 +53,12 @@ func main() {
app.Server = "WebP Server Go" app.Server = "WebP Server Go"
// Config Here // Config Here
config := load_config("config.json") var config_path string
flag.StringVar(&config_path, "config", "config.json", "/path/to/config.json. (Default: ./config.json)")
flag.Parse()
flag.PrintDefaults()
config := load_config(config_path)
HOST := config.HOST HOST := config.HOST
PORT := config.PORT PORT := config.PORT