2021-04-18 15:41:13 -04:00
|
|
|
// Copyright (c) 2015-2021 MinIO, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-03-16 15:21:58 -04:00
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
2019-10-04 13:35:33 -04:00
|
|
|
|
|
|
|
"github.com/minio/minio/pkg/color"
|
2017-03-16 15:21:58 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Prints the formatted startup message.
|
2017-10-27 18:07:46 -04:00
|
|
|
func printGatewayStartupMessage(apiEndPoints []string, backendType string) {
|
2017-06-09 22:50:51 -04:00
|
|
|
strippedAPIEndpoints := stripStandardPorts(apiEndPoints)
|
2018-03-28 17:14:06 -04:00
|
|
|
// If cache layer is enabled, print cache capacity.
|
2019-11-09 12:27:23 -05:00
|
|
|
cacheAPI := newCachedObjectLayerFn()
|
|
|
|
if cacheAPI != nil {
|
2020-04-09 12:30:02 -04:00
|
|
|
printCacheStorageInfo(cacheAPI.StorageInfo(GlobalContext))
|
2018-03-28 17:14:06 -04:00
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
// Prints credential.
|
2017-06-09 22:50:51 -04:00
|
|
|
printGatewayCommonMsg(strippedAPIEndpoints)
|
2017-03-16 15:21:58 -04:00
|
|
|
|
|
|
|
// Prints `mc` cli configuration message chooses
|
|
|
|
// first endpoint as default.
|
2017-06-09 22:50:51 -04:00
|
|
|
printCLIAccessMsg(strippedAPIEndpoints[0], fmt.Sprintf("my%s", backendType))
|
2017-03-16 15:21:58 -04:00
|
|
|
|
|
|
|
// Prints documentation message.
|
|
|
|
printObjectAPIMsg()
|
|
|
|
|
|
|
|
// SSL is configured reads certification chain, prints
|
|
|
|
// authority and expiry.
|
2020-04-30 19:15:29 -04:00
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
2020-12-22 00:42:38 -05:00
|
|
|
if globalIsTLS {
|
2020-04-30 19:15:29 -04:00
|
|
|
printCertificateMsg(globalPublicCerts)
|
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prints common server startup message. Prints credential, region and browser access.
|
2017-06-09 22:50:51 -04:00
|
|
|
func printGatewayCommonMsg(apiEndpoints []string) {
|
|
|
|
// Get saved credentials.
|
2019-10-23 01:59:13 -04:00
|
|
|
cred := globalActiveCred
|
2017-06-09 22:50:51 -04:00
|
|
|
|
2017-03-16 15:21:58 -04:00
|
|
|
apiEndpointStr := strings.Join(apiEndpoints, " ")
|
2018-12-18 11:26:30 -05:00
|
|
|
|
2017-03-16 15:21:58 -04:00
|
|
|
// Colorize the message and print.
|
2021-01-06 13:38:07 -05:00
|
|
|
logStartupMessage(color.Blue("Endpoint: ") + color.Bold(fmt.Sprintf("%s ", apiEndpointStr)))
|
2019-10-04 13:35:33 -04:00
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
2021-01-05 13:22:57 -05:00
|
|
|
logStartupMessage(color.Blue("RootUser: ") + color.Bold(fmt.Sprintf("%s ", cred.AccessKey)))
|
2021-01-06 13:38:07 -05:00
|
|
|
logStartupMessage(color.Blue("RootPass: ") + color.Bold(fmt.Sprintf("%s ", cred.SecretKey)))
|
2018-10-16 16:19:12 -04:00
|
|
|
}
|
2018-12-03 03:32:14 -05:00
|
|
|
printEventNotifiers()
|
2021-04-29 22:01:43 -04:00
|
|
|
|
|
|
|
if globalBrowserEnabled {
|
|
|
|
logStartupMessage(color.Blue("\nBrowser Access:"))
|
|
|
|
logStartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr))
|
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
}
|