mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (vet): go vet - #505
This commit is contained in:
parent
69f00c2a6f
commit
865442ea59
3 changed files with 13 additions and 14 deletions
|
|
@ -291,7 +291,7 @@ func (this *Configuration) Initialise() {
|
|||
}
|
||||
if env := os.Getenv("APPLICATION_URL"); env != "" {
|
||||
shouldSave = true
|
||||
this.Get("general.host").Set(env).String()
|
||||
_ = this.Get("general.host").Set(env).String()
|
||||
}
|
||||
if this.Get("general.secret_key").String() == "" {
|
||||
shouldSave = true
|
||||
|
|
@ -338,7 +338,7 @@ func (this *Configuration) Initialise() {
|
|||
InitSecretDerivate(this.Get("general.secret_key").String())
|
||||
}
|
||||
|
||||
func (this Configuration) Save() Configuration {
|
||||
func (this *Configuration) Save() {
|
||||
// convert config data to an appropriate json struct
|
||||
form := append(this.Form, Form{Title: "connections"})
|
||||
v := Form{Form: form}.ToJSON(func(el FormElement) string {
|
||||
|
|
@ -353,10 +353,9 @@ func (this Configuration) Save() Configuration {
|
|||
if err := SaveConfig(PrettyPrint([]byte(v))); err != nil {
|
||||
Log.Error("config::save %s", err.Error())
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
func (this Configuration) Export() interface{} {
|
||||
func (this *Configuration) Export() interface{} {
|
||||
return struct {
|
||||
Editor string `json:"editor"`
|
||||
ForkButton bool `json:"fork_button"`
|
||||
|
|
@ -482,7 +481,7 @@ func (this *Configuration) Set(value interface{}) *Configuration {
|
|||
return this
|
||||
}
|
||||
|
||||
func (this Configuration) String() string {
|
||||
func (this *Configuration) String() string {
|
||||
val := this.Interface()
|
||||
switch val.(type) {
|
||||
case string:
|
||||
|
|
@ -493,7 +492,7 @@ func (this Configuration) String() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (this Configuration) Int() int {
|
||||
func (this *Configuration) Int() int {
|
||||
val := this.Interface()
|
||||
switch val.(type) {
|
||||
case float64:
|
||||
|
|
@ -506,7 +505,7 @@ func (this Configuration) Int() int {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (this Configuration) Bool() bool {
|
||||
func (this *Configuration) Bool() bool {
|
||||
val := this.Interface()
|
||||
switch val.(type) {
|
||||
case bool:
|
||||
|
|
@ -515,7 +514,7 @@ func (this Configuration) Bool() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (this Configuration) Interface() interface{} {
|
||||
func (this *Configuration) Interface() interface{} {
|
||||
if this.currentElement == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -526,7 +525,7 @@ func (this Configuration) Interface() interface{} {
|
|||
return val
|
||||
}
|
||||
|
||||
func (this Configuration) MarshalJSON() ([]byte, error) {
|
||||
func (this *Configuration) MarshalJSON() ([]byte, error) {
|
||||
form := this.Form
|
||||
form = append(form, Form{
|
||||
Title: "constant",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ var USER_AGENT = fmt.Sprintf("Filestash/%s.%s (http://filestash.app)", APP_VERSI
|
|||
|
||||
var HTTPClient = http.Client{
|
||||
Timeout: 5 * time.Hour,
|
||||
Transport: NewTransormedTransport(http.Transport{
|
||||
Transport: NewTransformedTransport(&http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 10 * time.Second,
|
||||
KeepAlive: 10 * time.Second,
|
||||
|
|
@ -25,7 +25,7 @@ var HTTPClient = http.Client{
|
|||
|
||||
var HTTP = http.Client{
|
||||
Timeout: 10000 * time.Millisecond,
|
||||
Transport: NewTransormedTransport(http.Transport{
|
||||
Transport: NewTransformedTransport(&http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 5000 * time.Millisecond,
|
||||
KeepAlive: 5000 * time.Millisecond,
|
||||
|
|
@ -53,8 +53,8 @@ var DefaultTLSConfig = tls.Config{
|
|||
},
|
||||
}
|
||||
|
||||
func NewTransormedTransport(transport http.Transport) http.RoundTripper {
|
||||
return &TransformedTransport{&transport}
|
||||
func NewTransformedTransport(transport *http.Transport) http.RoundTripper {
|
||||
return &TransformedTransport{transport}
|
||||
}
|
||||
|
||||
type TransformedTransport struct {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
var configpath = filepath.Join(GetCurrentDir(), CONFIG_PATH, "config.json")
|
||||
|
||||
func PrivateConfigHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||
SendSuccessResult(res, Config)
|
||||
SendSuccessResult(res, &Config)
|
||||
}
|
||||
|
||||
func PrivateConfigUpdateHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue