fix(args): change arg prodmode name

This commit is contained in:
hexxa 2020-12-05 10:35:07 +08:00
parent 83100007e3
commit 31a1a331f7
4 changed files with 6 additions and 4 deletions

View file

@ -11,7 +11,7 @@ type Secrets struct {
} }
type ServerCfg struct { type ServerCfg struct {
ProdMode bool `json:"prodMode"` Debug bool `json:"debug"`
Addr string `json:"addr"` Addr string `json:"addr"`
ReadTimeout int `json:"readTimeout"` ReadTimeout int `json:"readTimeout"`
WriteTimeout int `json:"writeTimeout"` WriteTimeout int `json:"writeTimeout"`
@ -39,7 +39,7 @@ func NewDefaultConfig() *Config {
TokenSecret: "", TokenSecret: "",
}, },
Server: &ServerCfg{ Server: &ServerCfg{
ProdMode: true, Debug: false,
Addr: "127.0.0.1:8888", Addr: "127.0.0.1:8888",
ReadTimeout: 2000, ReadTimeout: 2000,
WriteTimeout: 2000, WriteTimeout: 2000,

Binary file not shown.

View file

@ -9,6 +9,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/ihexxa/gocfg" "github.com/ihexxa/gocfg"
"github.com/ihexxa/quickshare/src/cryptoutil/jwt" "github.com/ihexxa/quickshare/src/cryptoutil/jwt"
"github.com/ihexxa/quickshare/src/depidx" "github.com/ihexxa/quickshare/src/depidx"
"github.com/ihexxa/quickshare/src/fs" "github.com/ihexxa/quickshare/src/fs"
@ -30,7 +31,7 @@ type Server struct {
func NewServer(cfg gocfg.ICfg) (*Server, error) { func NewServer(cfg gocfg.ICfg) (*Server, error) {
deps := initDeps(cfg) deps := initDeps(cfg)
if cfg.BoolOr("Server.ProdMode", true) { if cfg.BoolOr("Server.Debug", false) {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
} }

View file

@ -10,6 +10,7 @@ import (
"time" "time"
"github.com/ihexxa/gocfg" "github.com/ihexxa/gocfg"
"github.com/ihexxa/quickshare/src/client" "github.com/ihexxa/quickshare/src/client"
"github.com/ihexxa/quickshare/src/handlers/fileshdr" "github.com/ihexxa/quickshare/src/handlers/fileshdr"
) )
@ -36,7 +37,7 @@ func TestFileHandlers(t *testing.T) {
chunkSize := 2 chunkSize := 2
config := `{ config := `{
"Server": { "Server": {
"ProdMode": false "Debug": true
}, },
"FS": { "FS": {
"Root": "./testData" "Root": "./testData"