storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/gateway-startup-msg.go (about) 1 /* 2 * MinIO Cloud Storage, (C) 2016, 2017 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package cmd 18 19 import ( 20 "fmt" 21 "strings" 22 23 "storj.io/minio/pkg/color" 24 ) 25 26 // Prints the formatted startup message. 27 func printGatewayStartupMessage(apiEndPoints []string, backendType string) { 28 strippedAPIEndpoints := stripStandardPorts(apiEndPoints) 29 // If cache layer is enabled, print cache capacity. 30 cacheAPI := newCachedObjectLayerFn() 31 if cacheAPI != nil { 32 printCacheStorageInfo(cacheAPI.StorageInfo(GlobalContext)) 33 } 34 // Prints credential. 35 printGatewayCommonMsg(strippedAPIEndpoints) 36 37 // Prints `mc` cli configuration message chooses 38 // first endpoint as default. 39 printCLIAccessMsg(strippedAPIEndpoints[0], fmt.Sprintf("my%s", backendType)) 40 41 // Prints documentation message. 42 printObjectAPIMsg() 43 44 // SSL is configured reads certification chain, prints 45 // authority and expiry. 46 if color.IsTerminal() && !GlobalCLIContext.Anonymous { 47 if GlobalIsTLS { 48 printCertificateMsg(globalPublicCerts) 49 } 50 } 51 } 52 53 // Prints common server startup message. Prints credential, region and browser access. 54 func printGatewayCommonMsg(apiEndpoints []string) { 55 // Get saved credentials. 56 cred := globalActiveCred 57 58 apiEndpointStr := strings.Join(apiEndpoints, " ") 59 60 // Colorize the message and print. 61 logStartupMessage(color.Blue("Endpoint: ") + color.Bold(fmt.Sprintf("%s ", apiEndpointStr))) 62 if color.IsTerminal() && !GlobalCLIContext.Anonymous { 63 logStartupMessage(color.Blue("RootUser: ") + color.Bold(fmt.Sprintf("%s ", cred.AccessKey))) 64 logStartupMessage(color.Blue("RootPass: ") + color.Bold(fmt.Sprintf("%s ", cred.SecretKey))) 65 } 66 printEventNotifiers() 67 68 if globalBrowserEnabled { 69 logStartupMessage(color.Blue("\nBrowser Access:")) 70 logStartupMessage(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 3), apiEndpointStr)) 71 } 72 }