2017-03-16 15:21:58 -04:00
|
|
|
/*
|
2019-04-09 14:39:42 -04:00
|
|
|
* MinIO Cloud Storage, (C) 2016, 2017 MinIO, Inc.
|
2017-03-16 15:21:58 -04: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 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.
|
|
|
|
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.
|
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.
|
2019-10-04 13:35:33 -04: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 16:19:12 -04:00
|
|
|
}
|
2018-12-03 03:32:14 -05:00
|
|
|
printEventNotifiers()
|
2017-06-09 22:50:51 -04:00
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
if globalBrowserEnabled {
|
2019-10-04 13:35:33 -04:00
|
|
|
logStartupMessage(color.Blue("\nBrowser Access:"))
|
2019-09-22 04:24:32 -04:00
|
|
|
logStartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr))
|
2018-01-04 00:30:52 -05:00
|
|
|
}
|
2017-03-16 15:21:58 -04:00
|
|
|
}
|