2017-03-16 20:21:58 +01:00
|
|
|
/*
|
2019-04-09 20:39:42 +02:00
|
|
|
* MinIO Cloud Storage, (C) 2016, 2017 MinIO, Inc.
|
2017-03-16 20:21:58 +01:00
|
|
|
*
|
|
|
|
* 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 (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
2019-10-04 19:35:33 +02:00
|
|
|
|
|
|
|
"github.com/minio/minio/pkg/color"
|
2017-03-16 20:21:58 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Prints the formatted startup message.
|
2017-10-28 00:07:46 +02:00
|
|
|
func printGatewayStartupMessage(apiEndPoints []string, backendType string) {
|
2017-06-10 04:50:51 +02:00
|
|
|
strippedAPIEndpoints := stripStandardPorts(apiEndPoints)
|
2018-03-28 23:14:06 +02:00
|
|
|
// If cache layer is enabled, print cache capacity.
|
2019-11-09 18:27:23 +01:00
|
|
|
cacheAPI := newCachedObjectLayerFn()
|
|
|
|
if cacheAPI != nil {
|
2020-04-09 18:30:02 +02:00
|
|
|
printCacheStorageInfo(cacheAPI.StorageInfo(GlobalContext))
|
2018-03-28 23:14:06 +02:00
|
|
|
}
|
2017-03-16 20:21:58 +01:00
|
|
|
// Prints credential.
|
2017-06-10 04:50:51 +02:00
|
|
|
printGatewayCommonMsg(strippedAPIEndpoints)
|
2017-03-16 20:21:58 +01:00
|
|
|
|
|
|
|
// Prints `mc` cli configuration message chooses
|
|
|
|
// first endpoint as default.
|
2017-06-10 04:50:51 +02:00
|
|
|
printCLIAccessMsg(strippedAPIEndpoints[0], fmt.Sprintf("my%s", backendType))
|
2017-03-16 20:21:58 +01:00
|
|
|
|
|
|
|
// Prints documentation message.
|
|
|
|
printObjectAPIMsg()
|
|
|
|
|
|
|
|
// SSL is configured reads certification chain, prints
|
|
|
|
// authority and expiry.
|
2020-05-01 01:15:29 +02:00
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
|
|
|
if globalIsSSL {
|
|
|
|
printCertificateMsg(globalPublicCerts)
|
|
|
|
}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prints common server startup message. Prints credential, region and browser access.
|
2017-06-10 04:50:51 +02:00
|
|
|
func printGatewayCommonMsg(apiEndpoints []string) {
|
|
|
|
// Get saved credentials.
|
2019-10-23 07:59:13 +02:00
|
|
|
cred := globalActiveCred
|
2017-06-10 04:50:51 +02:00
|
|
|
|
2017-03-16 20:21:58 +01:00
|
|
|
apiEndpointStr := strings.Join(apiEndpoints, " ")
|
2018-12-18 17:26:30 +01:00
|
|
|
|
2017-03-16 20:21:58 +01:00
|
|
|
// Colorize the message and print.
|
2019-10-04 19:35:33 +02:00
|
|
|
logStartupMessage(color.Blue("Endpoint: ") + color.Bold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr)))
|
|
|
|
if color.IsTerminal() && !globalCLIContext.Anonymous {
|
|
|
|
logStartupMessage(color.Blue("AccessKey: ") + color.Bold(fmt.Sprintf("%s ", cred.AccessKey)))
|
|
|
|
logStartupMessage(color.Blue("SecretKey: ") + color.Bold(fmt.Sprintf("%s ", cred.SecretKey)))
|
2018-10-16 22:19:12 +02:00
|
|
|
}
|
2018-12-03 09:32:14 +01:00
|
|
|
printEventNotifiers()
|
2017-06-10 04:50:51 +02:00
|
|
|
|
2019-10-23 07:59:13 +02:00
|
|
|
if globalBrowserEnabled {
|
2019-10-04 19:35:33 +02:00
|
|
|
logStartupMessage(color.Blue("\nBrowser Access:"))
|
2019-09-22 10:24:32 +02:00
|
|
|
logStartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr))
|
2018-01-04 06:30:52 +01:00
|
|
|
}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|