mirror of
https://github.com/minio/minio.git
synced 2025-11-26 20:38:20 -05:00
Add constants for commonly used values. (#3588)
This is a consolidation effort, avoiding usage of naked strings in codebase. Whenever possible use constants which can be repurposed elsewhere. This also fixes `goconst ./...` reported issues.
This commit is contained in:
@@ -65,9 +65,9 @@ func printHealMsg(endpoints []*url.URL, storageDisks []StorageAPI, fn printOnceF
|
||||
// for single node XL, distributed XL and when minio server is bound
|
||||
// to a specific ip:port.
|
||||
func getHealEndpoint(tls bool, firstEndpoint *url.URL) (cEndpoint *url.URL) {
|
||||
scheme := "http"
|
||||
scheme := httpScheme
|
||||
if tls {
|
||||
scheme = "https"
|
||||
scheme = httpsScheme
|
||||
}
|
||||
cEndpoint = &url.URL{
|
||||
Scheme: scheme,
|
||||
@@ -93,6 +93,12 @@ func getHealEndpoint(tls bool, firstEndpoint *url.URL) (cEndpoint *url.URL) {
|
||||
return cEndpoint
|
||||
}
|
||||
|
||||
// Disks offline and online strings..
|
||||
const (
|
||||
diskOffline = "offline"
|
||||
diskOnline = "online"
|
||||
)
|
||||
|
||||
// Constructs a formatted heal message, when cluster is found to be in state where it requires healing.
|
||||
// healing is optional, server continues to initialize object layer after printing this message.
|
||||
// it is upto the end user to perform a heal if needed.
|
||||
@@ -112,9 +118,9 @@ func getHealMsg(endpoints []*url.URL, storageDisks []StorageAPI) string {
|
||||
humanize.IBytes(uint64(info.Total)),
|
||||
func() string {
|
||||
if info.Total > 0 {
|
||||
return "online"
|
||||
return diskOnline
|
||||
}
|
||||
return "offline"
|
||||
return diskOffline
|
||||
}(),
|
||||
)
|
||||
}
|
||||
@@ -142,9 +148,9 @@ func getStorageInitMsg(titleMsg string, endpoints []*url.URL, storageDisks []Sto
|
||||
humanize.IBytes(uint64(info.Total)),
|
||||
func() string {
|
||||
if info.Total > 0 {
|
||||
return "online"
|
||||
return diskOnline
|
||||
}
|
||||
return "offline"
|
||||
return diskOffline
|
||||
}(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user