mirror of
https://github.com/minio/minio.git
synced 2025-11-23 02:57:42 -05:00
Extend further validation of config values (#8469)
- This PR allows config KVS to be validated properly without being affected by ENV overrides, rejects invalid values during set operation - Expands unit tests and refactors the error handling for notification targets, returns error instead of ignoring targets for invalid KVS - Does all the prep-work for implementing safe-mode style operation for MinIO server, introduces a new global variable to toggle safe mode based operations NOTE: this PR itself doesn't provide safe mode operations
This commit is contained in:
committed by
kannappanr
parent
599aae5ba6
commit
9e7a3e6adc
@@ -19,6 +19,7 @@ package net
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -103,6 +104,21 @@ func (u URL) DialHTTP() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ParseHTTPURL - parses a string into HTTP URL, string is
|
||||
// expected to be of form http:// or https://
|
||||
func ParseHTTPURL(s string) (u *URL, err error) {
|
||||
u, err = ParseURL(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch u.Scheme {
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected scheme found %s", u.Scheme)
|
||||
case "http", "https":
|
||||
return u, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ParseURL - parses string into URL.
|
||||
func ParseURL(s string) (u *URL, err error) {
|
||||
var uu *url.URL
|
||||
|
||||
Reference in New Issue
Block a user