| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | /* | 
					
						
							| 
									
										
										
										
											2018-03-01 12:13:33 +08:00
										 |  |  |  * Minio Cloud Storage, (C) 2017, 2018 Minio, Inc. | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08: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 ( | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	"context" | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2018-09-07 07:42:33 +08:00
										 |  |  | 	"net" | 
					
						
							| 
									
										
										
										
											2017-04-12 08:44:26 +08:00
										 |  |  | 	"net/url" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	"os" | 
					
						
							|  |  |  | 	"os/signal" | 
					
						
							| 
									
										
										
										
											2017-04-12 08:44:26 +08:00
										 |  |  | 	"strings" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	"syscall" | 
					
						
							| 
									
										
										
										
											2017-06-06 06:18:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/gorilla/mux" | 
					
						
							|  |  |  | 	"github.com/minio/cli" | 
					
						
							| 
									
										
										
										
											2018-04-22 10:23:54 +08:00
										 |  |  | 	xhttp "github.com/minio/minio/cmd/http" | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/logger" | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	"github.com/minio/minio/pkg/certs" | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  | func init() { | 
					
						
							| 
									
										
										
										
											2018-06-19 03:04:46 +08:00
										 |  |  | 	logger.Init(GOPATH, GOROOT) | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  | 	logger.RegisterUIError(fmtError) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | var ( | 
					
						
							|  |  |  | 	gatewayCmd = cli.Command{ | 
					
						
							|  |  |  | 		Name:            "gateway", | 
					
						
							|  |  |  | 		Usage:           "Start object storage gateway.", | 
					
						
							|  |  |  | 		Flags:           append(serverFlags, globalFlags...), | 
					
						
							|  |  |  | 		HideHelpCommand: true, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2017-06-09 14:28:45 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-28 06:07:46 +08:00
										 |  |  | // RegisterGatewayCommand registers a new command for gateway.
 | 
					
						
							|  |  |  | func RegisterGatewayCommand(cmd cli.Command) error { | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 	cmd.Flags = append(append(cmd.Flags, append(cmd.Flags, serverFlags...)...), globalFlags...) | 
					
						
							| 
									
										
										
										
											2017-10-28 06:07:46 +08:00
										 |  |  | 	gatewayCmd.Subcommands = append(gatewayCmd.Subcommands, cmd) | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | // ParseGatewayEndpoint - Return endpoint.
 | 
					
						
							|  |  |  | func ParseGatewayEndpoint(arg string) (endPoint string, secure bool, err error) { | 
					
						
							| 
									
										
										
										
											2017-04-12 08:44:26 +08:00
										 |  |  | 	schemeSpecified := len(strings.Split(arg, "://")) > 1 | 
					
						
							|  |  |  | 	if !schemeSpecified { | 
					
						
							|  |  |  | 		// Default connection will be "secure".
 | 
					
						
							|  |  |  | 		arg = "https://" + arg | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-04-28 02:26:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 08:44:26 +08:00
										 |  |  | 	u, err := url.Parse(arg) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		return "", false, err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	switch u.Scheme { | 
					
						
							|  |  |  | 	case "http": | 
					
						
							|  |  |  | 		return u.Host, false, nil | 
					
						
							|  |  |  | 	case "https": | 
					
						
							|  |  |  | 		return u.Host, true, nil | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		return "", false, fmt.Errorf("Unrecognized scheme %s", u.Scheme) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | // ValidateGatewayArguments - Validate gateway arguments.
 | 
					
						
							|  |  |  | func ValidateGatewayArguments(serverAddr, endpointAddr string) error { | 
					
						
							| 
									
										
										
										
											2017-06-09 02:20:56 +08:00
										 |  |  | 	if err := CheckLocalServerAddr(serverAddr); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if endpointAddr != "" { | 
					
						
							|  |  |  | 		// Reject the endpoint if it points to the gateway handler itself.
 | 
					
						
							|  |  |  | 		sameTarget, err := sameLocalAddrs(endpointAddr, serverAddr) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if sameTarget { | 
					
						
							| 
									
										
										
										
											2017-11-26 03:58:29 +08:00
										 |  |  | 			return fmt.Errorf("endpoint points to the local gateway") | 
					
						
							| 
									
										
										
										
											2017-06-09 02:20:56 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | // StartGateway - handler for 'minio gateway <name>'.
 | 
					
						
							|  |  |  | func StartGateway(ctx *cli.Context, gw Gateway) { | 
					
						
							|  |  |  | 	if gw == nil { | 
					
						
							| 
									
										
										
										
											2018-05-10 06:11:24 +08:00
										 |  |  | 		logger.FatalIf(errUnexpected, "Gateway implementation not initialized") | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	// Disable logging until gateway initialization is complete, any
 | 
					
						
							|  |  |  | 	// error during initialization will be shown as a fatal message
 | 
					
						
							|  |  |  | 	logger.Disable = true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 	// Validate if we have access, secret set through environment.
 | 
					
						
							|  |  |  | 	gatewayName := gw.Name() | 
					
						
							|  |  |  | 	if ctx.Args().First() == "help" { | 
					
						
							|  |  |  | 		cli.ShowCommandHelpAndExit(ctx, gatewayName, 1) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	// Get "json" flag from command line argument and
 | 
					
						
							|  |  |  | 	// enable json and quite modes if jason flag is turned on.
 | 
					
						
							| 
									
										
										
										
											2018-03-01 12:13:33 +08:00
										 |  |  | 	jsonFlag := ctx.IsSet("json") || ctx.GlobalIsSet("json") | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	if jsonFlag { | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 		logger.EnableJSON() | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	// Get quiet flag from command line argument.
 | 
					
						
							| 
									
										
										
										
											2018-03-01 12:13:33 +08:00
										 |  |  | 	quietFlag := ctx.IsSet("quiet") || ctx.GlobalIsSet("quiet") | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	if quietFlag { | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 		logger.EnableQuiet() | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-21 07:39:11 +08:00
										 |  |  | 	// Fetch address option
 | 
					
						
							|  |  |  | 	gatewayAddr := ctx.GlobalString("address") | 
					
						
							|  |  |  | 	if gatewayAddr == ":"+globalMinioPort { | 
					
						
							|  |  |  | 		gatewayAddr = ctx.String("address") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Handle common command args.
 | 
					
						
							|  |  |  | 	handleCommonCmdArgs(ctx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Handle common env vars.
 | 
					
						
							|  |  |  | 	handleCommonEnvVars() | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-07 07:42:33 +08:00
										 |  |  | 	// Get port to listen on from gateway address
 | 
					
						
							|  |  |  | 	_, gatewayPort, pErr := net.SplitHostPort(gatewayAddr) | 
					
						
							|  |  |  | 	if pErr != nil { | 
					
						
							|  |  |  | 		logger.FatalIf(pErr, "Unable to start gateway") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-18 12:06:36 +08:00
										 |  |  | 	// On macOS, if a process already listens on LOCALIPADDR:PORT, net.Listen() falls back
 | 
					
						
							|  |  |  | 	// to IPv6 address ie minio will start listening on IPv6 address whereas another
 | 
					
						
							|  |  |  | 	// (non-)minio process is listening on IPv4 of given port.
 | 
					
						
							|  |  |  | 	// To avoid this error situation we check for port availability.
 | 
					
						
							| 
									
										
										
										
											2018-09-07 07:42:33 +08:00
										 |  |  | 	logger.FatalIf(checkPortAvailability(gatewayPort), "Unable to start the gateway") | 
					
						
							| 
									
										
										
										
											2018-08-18 12:06:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-20 10:45:13 +08:00
										 |  |  | 	// Validate if we have access, secret set through environment.
 | 
					
						
							|  |  |  | 	if !globalIsEnvCreds { | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 		logger.Fatal(uiErrEnvCredentialsMissingGateway(nil), "Unable to start gateway") | 
					
						
							| 
									
										
										
										
											2017-06-20 10:45:13 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Create certs path.
 | 
					
						
							| 
									
										
										
										
											2018-05-10 06:11:24 +08:00
										 |  |  | 	logger.FatalIf(createConfigDir(), "Unable to create configuration directories") | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	// Initialize server config.
 | 
					
						
							|  |  |  | 	srvCfg := newServerConfig() | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	// Override any values from ENVs.
 | 
					
						
							|  |  |  | 	srvCfg.loadFromEnvs() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Load values to cached global values.
 | 
					
						
							|  |  |  | 	srvCfg.loadToCachedConfigs() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// hold the mutex lock before a new config is assigned.
 | 
					
						
							|  |  |  | 	globalServerConfigMu.Lock() | 
					
						
							|  |  |  | 	globalServerConfig = srvCfg | 
					
						
							|  |  |  | 	globalServerConfigMu.Unlock() | 
					
						
							| 
									
										
										
										
											2018-07-20 06:55:06 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-20 04:57:18 +08:00
										 |  |  | 	var cacheConfig = globalServerConfig.GetCacheConfig() | 
					
						
							|  |  |  | 	if len(cacheConfig.Drives) > 0 { | 
					
						
							|  |  |  | 		var err error | 
					
						
							|  |  |  | 		// initialize the new disk cache objects.
 | 
					
						
							|  |  |  | 		globalCacheObjectAPI, err = newServerCacheObjects(cacheConfig) | 
					
						
							|  |  |  | 		logger.FatalIf(err, "Unable to initialize disk caching") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Check and load SSL certificates.
 | 
					
						
							|  |  |  | 	var err error | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	globalPublicCerts, globalRootCAs, globalTLSCerts, globalIsSSL, err = getSSLConfig() | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	logger.FatalIf(err, "Invalid SSL certificate file") | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-24 22:39:30 +08:00
										 |  |  | 	// Set system resources to maximum.
 | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	logger.LogIf(context.Background(), setMaxResources()) | 
					
						
							| 
									
										
										
										
											2017-12-24 22:39:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-23 11:02:58 +08:00
										 |  |  | 	initNSLock(false) // Enable local namespace lock.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-25 06:53:30 +08:00
										 |  |  | 	// Create new notification system.
 | 
					
						
							| 
									
										
										
										
											2018-07-10 09:50:31 +08:00
										 |  |  | 	globalNotificationSys = NewNotificationSys(globalServerConfig, EndpointList{}) | 
					
						
							| 
									
										
										
										
											2018-04-25 06:53:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Create new policy system.
 | 
					
						
							|  |  |  | 	globalPolicySys = NewPolicySys() | 
					
						
							| 
									
										
										
										
											2018-03-16 04:03:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	router := mux.NewRouter().SkipClean(true) | 
					
						
							| 
									
										
										
										
											2017-06-02 00:43:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-05 10:07:54 +08:00
										 |  |  | 	// Add healthcheck router
 | 
					
						
							|  |  |  | 	registerHealthCheckRouter(router) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-30 12:43:46 +08:00
										 |  |  | 	// Add server metrics router
 | 
					
						
							|  |  |  | 	registerMetricsRouter(router) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-02 00:43:20 +08:00
										 |  |  | 	// Register web router when its enabled.
 | 
					
						
							|  |  |  | 	if globalIsBrowserEnabled { | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 		logger.FatalIf(registerWebRouter(router), "Unable to configure web browser") | 
					
						
							| 
									
										
										
										
											2017-06-02 00:43:20 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-05 10:07:54 +08:00
										 |  |  | 	// Add API router.
 | 
					
						
							|  |  |  | 	registerAPIRouter(router) | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	var getCert certs.GetCertificateFunc | 
					
						
							|  |  |  | 	if globalTLSCerts != nil { | 
					
						
							|  |  |  | 		getCert = globalTLSCerts.GetCertificate | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-26 04:51:49 +08:00
										 |  |  | 	globalHTTPServer = xhttp.NewServer([]string{gatewayAddr}, criticalErrorHandler{registerHandlers(router, globalHandlers...)}, getCert) | 
					
						
							| 
									
										
										
										
											2018-05-30 12:43:46 +08:00
										 |  |  | 	globalHTTPServer.UpdateBytesReadFunc = globalConnStats.incInputBytes | 
					
						
							|  |  |  | 	globalHTTPServer.UpdateBytesWrittenFunc = globalConnStats.incOutputBytes | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	go func() { | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 		globalHTTPServerErrorCh <- globalHTTPServer.Start() | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	}() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	newObject, err := gw.NewGatewayLayer(globalServerConfig.GetCredential()) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		// Stop watching for any certificate changes.
 | 
					
						
							|  |  |  | 		globalTLSCerts.Stop() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		globalHTTPServer.Shutdown() | 
					
						
							|  |  |  | 		logger.FatalIf(err, "Unable to initialize gateway backend") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-04 06:12:18 +08:00
										 |  |  | 	go globalPolicySys.Init(newObject) | 
					
						
							| 
									
										
										
										
											2018-06-27 14:59:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	// Once endpoints are finalized, initialize the new object api.
 | 
					
						
							|  |  |  | 	globalObjLayerMutex.Lock() | 
					
						
							|  |  |  | 	globalObjectAPI = newObject | 
					
						
							|  |  |  | 	globalObjLayerMutex.Unlock() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Prints the formatted startup message once object layer is initialized.
 | 
					
						
							|  |  |  | 	if !quietFlag { | 
					
						
							| 
									
										
										
										
											2017-10-28 06:07:46 +08:00
										 |  |  | 		mode := globalMinioModeGatewayPrefix + gatewayName | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 		// Check update mode.
 | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 		checkUpdate(mode) | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 		// Print a warning message if gateway is not ready for production before the startup banner.
 | 
					
						
							|  |  |  | 		if !gw.Production() { | 
					
						
							| 
									
										
										
										
											2018-04-14 02:57:05 +08:00
										 |  |  | 			logger.StartupMessage(colorYellow("               *** Warning: Not Ready for Production ***")) | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 		// Print gateway startup message.
 | 
					
						
							| 
									
										
										
										
											2017-10-28 06:07:46 +08:00
										 |  |  | 		printGatewayStartupMessage(getAPIEndpoints(gatewayAddr), gatewayName) | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	// Reenable logging
 | 
					
						
							|  |  |  | 	logger.Disable = false | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	handleSignals() | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | } |