2017-03-16 15:21:58 -04:00
|
|
|
/*
|
|
|
|
* Minio Cloud Storage, (C) 2016, 2017 Minio, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2018-03-28 17:14:06 -04:00
|
|
|
"context"
|
2017-03-16 15:21:58 -04:00
|
|
|
"fmt"
|
|
|
|
"strings"
|
2018-04-05 18:04:40 -04:00
|
|
|
|
|
|
|
"github.com/minio/minio/cmd/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) {
|
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.
|
|
|
|
cacheObjectAPI := newCacheObjectsFn()
|
|
|
|
if cacheObjectAPI != nil {
|
|
|
|
printCacheStorageInfo(cacheObjectAPI.StorageInfo(context.Background()))
|
|
|
|
}
|
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.
|
|
|
|
if globalIsSSL {
|
2017-03-30 14:21:19 -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.
|
2017-11-29 16:12:47 -05:00
|
|
|
cred := globalServerConfig.GetCredential()
|
2017-06-09 22:50:51 -04:00
|
|
|
|
2017-03-16 15:21:58 -04:00
|
|
|
apiEndpointStr := strings.Join(apiEndpoints, " ")
|
|
|
|
// Colorize the message and print.
|
2018-04-10 12:37:14 -04:00
|
|
|
logger.StartupMessage(colorBlue("\nEndpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr)))
|
2018-10-16 16:19:12 -04:00
|
|
|
if isTerminal() {
|
|
|
|
logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey)))
|
|
|
|
logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey)))
|
|
|
|
}
|
2018-12-03 03:32:14 -05:00
|
|
|
printEventNotifiers()
|
2017-06-09 22:50:51 -04:00
|
|
|
|
2018-01-04 00:30:52 -05:00
|
|
|
if globalIsBrowserEnabled {
|
2018-04-10 12:37:14 -04:00
|
|
|
logger.StartupMessage(colorBlue("\nBrowser Access:"))
|
|
|
|
logger.StartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr))
|
2018-01-04 00:30:52 -05:00
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
}
|