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
|
|
|
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/color"
|
2022-03-03 16:21:16 -05:00
|
|
|
"github.com/minio/minio/internal/logger"
|
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) {
|
2022-06-28 19:37:40 -04:00
|
|
|
if len(globalSubnetConfig.APIKey) == 0 {
|
|
|
|
var builder strings.Builder
|
|
|
|
startupBanner(&builder)
|
|
|
|
logger.Info("\n" + builder.String())
|
|
|
|
}
|
|
|
|
|
2021-06-21 02:04:47 -04:00
|
|
|
strippedAPIEndpoints := stripStandardPorts(apiEndPoints, globalMinioHost)
|
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()
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
2022-03-03 16:21:16 -05:00
|
|
|
logger.Info(color.Blue("API: ") + color.Bold(fmt.Sprintf("%s ", apiEndpointStr)))
|
2019-10-04 13:35:33 -04:00
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
2022-03-03 16:21:16 -05:00
|
|
|
logger.Info(color.Blue("RootUser: ") + color.Bold(fmt.Sprintf("%s ", cred.AccessKey)))
|
|
|
|
logger.Info(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 {
|
2021-06-21 02:04:47 -04:00
|
|
|
consoleEndpointStr := strings.Join(stripStandardPorts(getConsoleEndpoints(), globalMinioConsoleHost), " ")
|
2022-03-03 16:21:16 -05:00
|
|
|
logger.Info(color.Blue("\nConsole: ") + color.Bold(fmt.Sprintf("%s ", consoleEndpointStr)))
|
2021-06-17 23:27:04 -04:00
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
2022-03-03 16:21:16 -05:00
|
|
|
logger.Info(color.Blue("RootUser: ") + color.Bold(fmt.Sprintf("%s ", cred.AccessKey)))
|
|
|
|
logger.Info(color.Blue("RootPass: ") + color.Bold(fmt.Sprintf("%s ", cred.SecretKey)))
|
2021-06-17 23:27:04 -04:00
|
|
|
}
|
2021-04-29 22:01:43 -04:00
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
}
|