update banner to reflect the final agreed UI (#15192)

This commit is contained in:
Harshavardhana 2022-06-28 16:37:40 -07:00 committed by GitHub
parent 2070c215a2
commit 2f25639ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 9 deletions

View File

@ -27,6 +27,12 @@ import (
// Prints the formatted startup message. // Prints the formatted startup message.
func printGatewayStartupMessage(apiEndPoints []string, backendType string) { func printGatewayStartupMessage(apiEndPoints []string, backendType string) {
if len(globalSubnetConfig.APIKey) == 0 {
var builder strings.Builder
startupBanner(&builder)
logger.Info("\n" + builder.String())
}
strippedAPIEndpoints := stripStandardPorts(apiEndPoints, globalMinioHost) strippedAPIEndpoints := stripStandardPorts(apiEndPoints, globalMinioHost)
// If cache layer is enabled, print cache capacity. // If cache layer is enabled, print cache capacity.
cacheAPI := newCachedObjectLayerFn() cacheAPI := newCachedObjectLayerFn()

View File

@ -19,10 +19,12 @@ package cmd
import ( import (
"fmt" "fmt"
"io"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort" "sort"
"strings"
"github.com/minio/cli" "github.com/minio/cli"
"github.com/minio/minio/internal/color" "github.com/minio/minio/internal/color"
@ -163,11 +165,21 @@ func newApp(name string) *cli.App {
return app return app
} }
func startupBanner(banner io.Writer) {
fmt.Fprintln(banner, color.Blue("Runtime:")+color.Bold(" %s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH))
fmt.Fprintln(banner, color.Blue("License:")+color.Bold(" GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>"))
fmt.Fprintln(banner, color.Blue("Copyright:")+color.Bold(" 2015-%s MinIO, Inc.", CopyrightYear))
}
func versionBanner(c *cli.Context) io.Reader {
banner := &strings.Builder{}
fmt.Fprintln(banner, color.Bold("%s version %s (commit-id=%s)", c.App.Name, c.App.Version, CommitID))
startupBanner(banner)
return strings.NewReader(banner.String())
}
func printMinIOVersion(c *cli.Context) { func printMinIOVersion(c *cli.Context) {
fmt.Fprintln(c.App.Writer, color.Greenf("%s version %s (commit-id=%s)", c.App.Name, c.App.Version, CommitID)) io.Copy(c.App.Writer, versionBanner(c))
fmt.Fprintln(c.App.Writer, color.Greenf("Runtime: %s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH))
fmt.Fprintln(c.App.Writer, color.Greenf("Copyright (c) 2015-%s MinIO, Inc.", CopyrightYear))
fmt.Fprintln(c.App.Writer, color.Red("Licence GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>"))
} }
// Main main for minio server. // Main main for minio server.

View File

@ -51,8 +51,9 @@ func printStartupMessage(apiEndpoints []string, err error) {
} }
if len(globalSubnetConfig.APIKey) == 0 && err == nil { if len(globalSubnetConfig.APIKey) == 0 && err == nil {
logger.Info(color.Blue("\nLicense:") + " GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>") var builder strings.Builder
logger.Info(color.Yellow("Detected a deployment not registered with SUBNET. Please register your deployment via 'mc support register ALIAS'\n")) startupBanner(&builder)
logger.Info("\n" + builder.String())
} }
strippedAPIEndpoints := stripStandardPorts(apiEndpoints, globalMinioHost) strippedAPIEndpoints := stripStandardPorts(apiEndpoints, globalMinioHost)

View File

@ -31,11 +31,11 @@ var (
return !color.NoColor return !color.NoColor
} }
Bold = func() func(a ...interface{}) string { Bold = func() func(format string, a ...interface{}) string {
if IsTerminal() { if IsTerminal() {
return color.New(color.Bold).SprintFunc() return color.New(color.Bold).SprintfFunc()
} }
return fmt.Sprint return fmt.Sprintf
}() }()
RedBold = func() func(format string, a ...interface{}) string { RedBold = func() func(format string, a ...interface{}) string {