| 
									
										
										
										
											2015-12-08 06:12:47 +08:00
										 |  |  |  | /* | 
					
						
							| 
									
										
										
										
											2018-03-16 04:03:41 +08:00
										 |  |  |  |  * Minio Cloud Storage, (C) 2015, 2016, 2017, 2018 Minio, Inc. | 
					
						
							| 
									
										
										
										
											2015-12-08 06:12:47 +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. | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-19 07:23:42 +08:00
										 |  |  |  | package cmd | 
					
						
							| 
									
										
										
										
											2015-12-08 06:12:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-09 11:34:27 +08:00
										 |  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2016-11-11 23:18:44 +08:00
										 |  |  |  | 	"crypto/x509" | 
					
						
							| 
									
										
										
										
											2018-08-06 20:46:49 +08:00
										 |  |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  |  | 	"os" | 
					
						
							| 
									
										
										
										
											2016-09-10 06:33:35 +08:00
										 |  |  |  | 	"time" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 20:46:49 +08:00
										 |  |  |  | 	isatty "github.com/mattn/go-isatty" | 
					
						
							| 
									
										
										
										
											2018-05-12 03:02:30 +08:00
										 |  |  |  | 	"github.com/minio/minio-go/pkg/set" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-13 05:12:40 +08:00
										 |  |  |  | 	etcd "github.com/coreos/etcd/clientv3" | 
					
						
							| 
									
										
										
										
											2016-11-23 10:18:22 +08:00
										 |  |  |  | 	humanize "github.com/dustin/go-humanize" | 
					
						
							| 
									
										
										
										
											2016-07-09 11:34:27 +08:00
										 |  |  |  | 	"github.com/fatih/color" | 
					
						
							| 
									
										
										
										
											2018-08-18 03:52:14 +08:00
										 |  |  |  | 	"github.com/minio/minio/cmd/crypto" | 
					
						
							| 
									
										
										
										
											2018-04-22 10:23:54 +08:00
										 |  |  |  | 	xhttp "github.com/minio/minio/cmd/http" | 
					
						
							| 
									
										
										
										
											2017-11-01 02:54:32 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/auth" | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/certs" | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/dns" | 
					
						
							| 
									
										
										
										
											2019-02-23 11:18:01 +08:00
										 |  |  |  | 	iampolicy "github.com/minio/minio/pkg/iam/policy" | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/iam/validator" | 
					
						
							| 
									
										
										
										
											2016-07-09 11:34:27 +08:00
										 |  |  |  | ) | 
					
						
							| 
									
										
											  
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											
										 
											2016-02-13 07:27:10 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // minio configuration related constants.
 | 
					
						
							|  |  |  |  | const ( | 
					
						
							| 
									
										
										
										
											2016-10-15 02:15:59 +08:00
										 |  |  |  | 	globalMinioCertExpireWarnDays = time.Hour * 24 * 30 // 30 days.
 | 
					
						
							| 
									
										
										
										
											2017-01-19 04:24:34 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | 	globalMinioDefaultPort = "9000" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-21 06:01:13 +08:00
										 |  |  |  | 	globalMinioDefaultRegion = "" | 
					
						
							|  |  |  |  | 	// This is a sha256 output of ``arn:aws:iam::minio:user/admin``,
 | 
					
						
							|  |  |  |  | 	// this is kept in present form to be compatible with S3 owner ID
 | 
					
						
							|  |  |  |  | 	// requirements -
 | 
					
						
							|  |  |  |  | 	//
 | 
					
						
							|  |  |  |  | 	// ```
 | 
					
						
							|  |  |  |  | 	//    The canonical user ID is the Amazon S3–only concept.
 | 
					
						
							|  |  |  |  | 	//    It is 64-character obfuscated version of the account ID.
 | 
					
						
							|  |  |  |  | 	// ```
 | 
					
						
							|  |  |  |  | 	// http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example4.html
 | 
					
						
							|  |  |  |  | 	globalMinioDefaultOwnerID      = "02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4" | 
					
						
							| 
									
										
										
										
											2017-01-19 04:24:34 +08:00
										 |  |  |  | 	globalMinioDefaultStorageClass = "STANDARD" | 
					
						
							|  |  |  |  | 	globalWindowsOSName            = "windows" | 
					
						
							| 
									
										
										
										
											2017-02-09 14:27:35 +08:00
										 |  |  |  | 	globalNetBSDOSName             = "netbsd" | 
					
						
							|  |  |  |  | 	globalSolarisOSName            = "solaris" | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  |  | 	globalMinioModeFS              = "mode-server-fs" | 
					
						
							|  |  |  |  | 	globalMinioModeXL              = "mode-server-xl" | 
					
						
							|  |  |  |  | 	globalMinioModeDistXL          = "mode-server-distributed-xl" | 
					
						
							| 
									
										
										
										
											2017-10-28 06:07:46 +08:00
										 |  |  |  | 	globalMinioModeGatewayPrefix   = "mode-gateway-" | 
					
						
							| 
									
										
										
										
											2017-09-20 07:08:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-10 07:18:56 +08:00
										 |  |  |  | 	// Add new global values here.
 | 
					
						
							| 
									
										
											  
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											
										 
											2016-02-13 07:27:10 +08:00
										 |  |  |  | ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 12:13:20 +08:00
										 |  |  |  | const ( | 
					
						
							|  |  |  |  | 	// Limit fields size (except file) to 1Mib since Policy document
 | 
					
						
							|  |  |  |  | 	// can reach that size according to https://aws.amazon.com/articles/1434
 | 
					
						
							|  |  |  |  | 	maxFormFieldSize = int64(1 * humanize.MiByte) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-03 02:45:00 +08:00
										 |  |  |  | 	// Limit memory allocation to store multipart data
 | 
					
						
							|  |  |  |  | 	maxFormMemory = int64(5 * humanize.MiByte) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-08 02:16:45 +08:00
										 |  |  |  | 	// The maximum allowed time difference between the incoming request
 | 
					
						
							|  |  |  |  | 	// date and server date during signature verification.
 | 
					
						
							|  |  |  |  | 	globalMaxSkewTime = 15 * time.Minute // 15 minutes skew allowed.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-06 06:16:43 +08:00
										 |  |  |  | 	// GlobalMultipartExpiry - Expiry duration after which the multipart uploads are deemed stale.
 | 
					
						
							|  |  |  |  | 	GlobalMultipartExpiry = time.Hour * 24 * 14 // 2 weeks.
 | 
					
						
							|  |  |  |  | 	// GlobalMultipartCleanupInterval - Cleanup interval when the stale multipart cleanup is initiated.
 | 
					
						
							|  |  |  |  | 	GlobalMultipartCleanupInterval = time.Hour * 24 // 24 hrs.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-07 03:52:56 +08:00
										 |  |  |  | 	// Refresh interval to update in-memory bucket policy cache.
 | 
					
						
							|  |  |  |  | 	globalRefreshBucketPolicyInterval = 5 * time.Minute | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 	// Refresh interval to update in-memory iam config cache.
 | 
					
						
							|  |  |  |  | 	globalRefreshIAMInterval = 5 * time.Minute | 
					
						
							| 
									
										
										
										
											2018-05-05 02:16:14 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Limit of location constraint XML for unauthenticted PUT bucket operations.
 | 
					
						
							|  |  |  |  | 	maxLocationConstraintSize = 3 * humanize.MiByte | 
					
						
							| 
									
										
										
										
											2016-11-23 12:13:20 +08:00
										 |  |  |  | ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | var globalCLIContext = struct { | 
					
						
							|  |  |  |  | 	JSON, Quiet bool | 
					
						
							|  |  |  |  | 	Anonymous   bool | 
					
						
							|  |  |  |  | 	Addr        string | 
					
						
							|  |  |  |  | }{} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-25 08:20:49 +08:00
										 |  |  |  | var ( | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  |  | 	// Indicates the total number of erasure coded sets configured.
 | 
					
						
							|  |  |  |  | 	globalXLSetCount int | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Indicates set drive count.
 | 
					
						
							|  |  |  |  | 	globalXLSetDriveCount int | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  |  | 	// Indicates if the running minio server is distributed setup.
 | 
					
						
							|  |  |  |  | 	globalIsDistXL = false | 
					
						
							| 
									
										
										
										
											2016-11-29 04:15:36 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-23 16:32:55 +08:00
										 |  |  |  | 	// Indicates if the running minio server is an erasure-code backend.
 | 
					
						
							|  |  |  |  | 	globalIsXL = false | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 06:59:53 +08:00
										 |  |  |  | 	// This flag is set to 'true' by default
 | 
					
						
							|  |  |  |  | 	globalIsBrowserEnabled = true | 
					
						
							| 
									
										
										
										
											2017-05-25 12:09:23 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 06:59:53 +08:00
										 |  |  |  | 	// This flag is set to 'true' when MINIO_BROWSER env is set.
 | 
					
						
							|  |  |  |  | 	globalIsEnvBrowser = false | 
					
						
							| 
									
										
										
										
											2017-04-10 01:44:10 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 06:59:53 +08:00
										 |  |  |  | 	// Set to true if credentials were passed from env, default is false.
 | 
					
						
							|  |  |  |  | 	globalIsEnvCreds = false | 
					
						
							| 
									
										
										
										
											2016-12-10 16:42:22 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-16 04:33:42 +08:00
										 |  |  |  | 	// This flag is set to 'true' when MINIO_REGION env is set.
 | 
					
						
							| 
									
										
										
										
											2017-04-10 01:44:10 +08:00
										 |  |  |  | 	globalIsEnvRegion = false | 
					
						
							| 
									
										
										
										
											2017-05-25 12:09:23 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-16 04:33:42 +08:00
										 |  |  |  | 	// This flag is set to 'true' when MINIO_UPDATE env is set to 'off'. Default is false.
 | 
					
						
							|  |  |  |  | 	globalInplaceUpdateDisabled = false | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-10 01:44:10 +08:00
										 |  |  |  | 	// This flag is set to 'us-east-1' by default
 | 
					
						
							|  |  |  |  | 	globalServerRegion = globalMinioDefaultRegion | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-31 07:44:42 +08:00
										 |  |  |  | 	// Maximum size of internal objects parts
 | 
					
						
							|  |  |  |  | 	globalPutPartSize = int64(64 * 1024 * 1024) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-12 16:03:50 +08:00
										 |  |  |  | 	// Minio local server address (in `host:port` format)
 | 
					
						
							|  |  |  |  | 	globalMinioAddr = "" | 
					
						
							| 
									
										
										
										
											2016-10-06 03:48:07 +08:00
										 |  |  |  | 	// Minio default port, can be changed through command line.
 | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | 	globalMinioPort = globalMinioDefaultPort | 
					
						
							| 
									
										
										
										
											2016-10-19 03:49:24 +08:00
										 |  |  |  | 	// Holds the host that was passed using --address
 | 
					
						
							|  |  |  |  | 	globalMinioHost = "" | 
					
						
							| 
									
										
										
										
											2016-12-29 19:13:51 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  |  | 	// globalConfigSys server config system.
 | 
					
						
							|  |  |  |  | 	globalConfigSys *ConfigSys | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-16 04:03:41 +08:00
										 |  |  |  | 	globalNotificationSys *NotificationSys | 
					
						
							| 
									
										
										
										
											2018-04-25 06:53:30 +08:00
										 |  |  |  | 	globalPolicySys       *PolicySys | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 	globalIAMSys          *IAMSys | 
					
						
							| 
									
										
										
										
											2016-10-12 16:03:50 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-11 23:18:44 +08:00
										 |  |  |  | 	// CA root certificates, a nil value means system certs pool will be used
 | 
					
						
							|  |  |  |  | 	globalRootCAs *x509.CertPool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-12 05:59:51 +08:00
										 |  |  |  | 	// IsSSL indicates if the server is configured with SSL.
 | 
					
						
							|  |  |  |  | 	globalIsSSL bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  |  | 	globalTLSCerts *certs.Certs | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 10:23:54 +08:00
										 |  |  |  | 	globalHTTPServer        *xhttp.Server | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  |  | 	globalHTTPServerErrorCh = make(chan error) | 
					
						
							|  |  |  |  | 	globalOSSignalCh        = make(chan os.Signal, 1) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-06 03:24:31 +08:00
										 |  |  |  | 	// File to log HTTP request/response headers and body.
 | 
					
						
							|  |  |  |  | 	globalHTTPTraceFile *os.File | 
					
						
							| 
									
										
										
										
											2017-10-25 10:04:51 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  |  | 	globalEndpoints EndpointList | 
					
						
							| 
									
										
										
										
											2017-01-23 16:32:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-07 01:29:53 +08:00
										 |  |  |  | 	// Global server's network statistics
 | 
					
						
							|  |  |  |  | 	globalConnStats = newConnStats() | 
					
						
							| 
									
										
										
										
											2017-02-08 16:13:02 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-07 01:29:53 +08:00
										 |  |  |  | 	// Global HTTP request statisitics
 | 
					
						
							|  |  |  |  | 	globalHTTPStats = newHTTPStats() | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-08 16:13:02 +08:00
										 |  |  |  | 	// Time when object layer was initialized on start up.
 | 
					
						
							|  |  |  |  | 	globalBootTime time.Time | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 02:17:13 +08:00
										 |  |  |  | 	globalActiveCred  auth.Credentials | 
					
						
							|  |  |  |  | 	globalPublicCerts []*x509.Certificate | 
					
						
							| 
									
										
										
										
											2017-11-15 08:56:24 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-23 11:18:01 +08:00
										 |  |  |  | 	globalDomainNames []string      // Root domains for virtual host style requests
 | 
					
						
							|  |  |  |  | 	globalDomainIPs   set.StringSet // Root domain IP address(s) for a distributed Minio deployment
 | 
					
						
							| 
									
										
										
										
											2017-09-01 02:29:22 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	globalListingTimeout   = newDynamicTimeout( /*30*/ 600*time.Second /*5*/, 600*time.Second) // timeout for listing related ops
 | 
					
						
							|  |  |  |  | 	globalObjectTimeout    = newDynamicTimeout( /*1*/ 10*time.Minute /*10*/, 600*time.Second)  // timeout for Object API related ops
 | 
					
						
							|  |  |  |  | 	globalOperationTimeout = newDynamicTimeout(10*time.Minute /*30*/, 600*time.Second)         // default timeout for general ops
 | 
					
						
							|  |  |  |  | 	globalHealingTimeout   = newDynamicTimeout(30*time.Minute /*1*/, 30*time.Minute)           // timeout for healing related ops
 | 
					
						
							| 
									
										
										
										
											2016-03-25 08:20:49 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-22 19:28:13 +08:00
										 |  |  |  | 	// Storage classes
 | 
					
						
							|  |  |  |  | 	// Set to indicate if storage class is set up
 | 
					
						
							|  |  |  |  | 	globalIsStorageClass bool | 
					
						
							|  |  |  |  | 	// Set to store reduced redundancy storage class
 | 
					
						
							|  |  |  |  | 	globalRRStorageClass storageClass | 
					
						
							|  |  |  |  | 	// Set to store standard storage class
 | 
					
						
							|  |  |  |  | 	globalStandardStorageClass storageClass | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	globalIsEnvWORM bool | 
					
						
							|  |  |  |  | 	// Is worm enabled
 | 
					
						
							| 
									
										
										
										
											2018-03-28 07:44:45 +08:00
										 |  |  |  | 	globalWORMEnabled bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 	// Is Disk Caching set up
 | 
					
						
							|  |  |  |  | 	globalIsDiskCacheEnabled bool | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 	// Disk cache drives
 | 
					
						
							|  |  |  |  | 	globalCacheDrives []string | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 	// Disk cache excludes
 | 
					
						
							|  |  |  |  | 	globalCacheExcludes []string | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 	// Disk cache expiry
 | 
					
						
							|  |  |  |  | 	globalCacheExpiry = 90 | 
					
						
							| 
									
										
										
										
											2018-06-26 01:24:12 +08:00
										 |  |  |  | 	// Max allowed disk cache percentage
 | 
					
						
							|  |  |  |  | 	globalCacheMaxUse = 80 | 
					
						
							| 
									
										
										
										
											2018-06-06 16:51:56 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// RPC V1 - Initial version
 | 
					
						
							|  |  |  |  | 	// RPC V2 - format.json XL version changed to 2
 | 
					
						
							|  |  |  |  | 	// RPC V3 - format.json XL version changed to 3
 | 
					
						
							| 
									
										
										
										
											2018-09-13 01:45:28 +08:00
										 |  |  |  | 	// RPC V4 - ReadFile() arguments signature changed
 | 
					
						
							| 
									
										
										
										
											2018-06-06 16:51:56 +08:00
										 |  |  |  | 	// Current RPC version
 | 
					
						
							| 
									
										
										
										
											2018-09-13 01:45:28 +08:00
										 |  |  |  | 	globalRPCAPIVersion = RPCVersion{4, 0, 0} | 
					
						
							| 
									
										
										
										
											2018-06-06 16:51:56 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	// Allocated etcd endpoint for config and bucket DNS.
 | 
					
						
							| 
									
										
										
										
											2018-07-13 05:12:40 +08:00
										 |  |  |  | 	globalEtcdClient *etcd.Client | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Allocated DNS config wrapper over etcd client.
 | 
					
						
							|  |  |  |  | 	globalDNSConfig dns.Config | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-05 09:35:41 +08:00
										 |  |  |  | 	// Default usage check interval value.
 | 
					
						
							|  |  |  |  | 	globalDefaultUsageCheckInterval = 12 * time.Hour // 12 hours
 | 
					
						
							|  |  |  |  | 	// Usage check interval value.
 | 
					
						
							|  |  |  |  | 	globalUsageCheckInterval = globalDefaultUsageCheckInterval | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-18 03:52:14 +08:00
										 |  |  |  | 	// KMS key id
 | 
					
						
							|  |  |  |  | 	globalKMSKeyID string | 
					
						
							| 
									
										
										
										
											2019-01-06 06:16:43 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// GlobalKMS initialized KMS configuration
 | 
					
						
							|  |  |  |  | 	GlobalKMS crypto.KMS | 
					
						
							| 
									
										
										
										
											2018-09-28 11:36:17 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-15 05:35:48 +08:00
										 |  |  |  | 	// Auto-Encryption, if enabled, turns any non-SSE-C request
 | 
					
						
							|  |  |  |  | 	// into an SSE-S3 request. If enabled a valid, non-empty KMS
 | 
					
						
							|  |  |  |  | 	// configuration must be present.
 | 
					
						
							|  |  |  |  | 	globalAutoEncryption bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-28 11:36:17 +08:00
										 |  |  |  | 	// Is compression include extensions/content-types set.
 | 
					
						
							|  |  |  |  | 	globalIsEnvCompression bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Is compression enabeld.
 | 
					
						
							|  |  |  |  | 	globalIsCompressionEnabled = false | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Include-list for compression.
 | 
					
						
							|  |  |  |  | 	globalCompressExtensions = []string{".txt", ".log", ".csv", ".json"} | 
					
						
							|  |  |  |  | 	globalCompressMimeTypes  = []string{"text/csv", "text/plain", "application/json"} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Some standard object extensions which we strictly dis-allow for compression.
 | 
					
						
							|  |  |  |  | 	standardExcludeCompressExtensions = []string{".gz", ".bz2", ".rar", ".zip", ".7z"} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Some standard content-types which we strictly dis-allow for compression.
 | 
					
						
							|  |  |  |  | 	standardExcludeCompressContentTypes = []string{"video/*", "audio/*", "application/zip", "application/x-gzip", "application/x-zip-compressed", " application/x-compress", "application/x-spoon"} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 	// Authorization validators list.
 | 
					
						
							|  |  |  |  | 	globalIAMValidators *validator.Validators | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// OPA policy system.
 | 
					
						
							|  |  |  |  | 	globalPolicyOPA *iampolicy.Opa | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-20 06:47:03 +08:00
										 |  |  |  | 	// Deployment ID - unique per deployment
 | 
					
						
							|  |  |  |  | 	globalDeploymentID string | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-06 06:16:43 +08:00
										 |  |  |  | 	// GlobalGatewaySSE sse options
 | 
					
						
							|  |  |  |  | 	GlobalGatewaySSE gatewaySSE | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	// Add new variable global values here.
 | 
					
						
							| 
									
										
										
										
											2016-09-10 06:33:35 +08:00
										 |  |  |  | ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											
										 
											2016-02-13 07:27:10 +08:00
										 |  |  |  | // global colors.
 | 
					
						
							|  |  |  |  | var ( | 
					
						
							| 
									
										
										
										
											2018-08-06 20:46:49 +08:00
										 |  |  |  | 	// Check if we stderr, stdout are dumb terminals, we do not apply
 | 
					
						
							|  |  |  |  | 	// ansi coloring on dumb terminals.
 | 
					
						
							|  |  |  |  | 	isTerminal = func() bool { | 
					
						
							|  |  |  |  | 		return isatty.IsTerminal(os.Stdout.Fd()) && isatty.IsTerminal(os.Stderr.Fd()) | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	colorBold = func() func(a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.Bold).SprintFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprint | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorRed = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgRed).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorBlue = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgBlue).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorYellow = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgYellow).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorCyanBold = func() func(a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			color.New(color.FgCyan, color.Bold).SprintFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprint | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorYellowBold = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgYellow, color.Bold).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorBgYellow = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.BgYellow).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorBlack = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgBlack).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorGreenBold = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgGreen, color.Bold).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							|  |  |  |  | 	colorRedBold = func() func(format string, a ...interface{}) string { | 
					
						
							|  |  |  |  | 		if isTerminal() { | 
					
						
							|  |  |  |  | 			return color.New(color.FgRed, color.Bold).SprintfFunc() | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return fmt.Sprintf | 
					
						
							|  |  |  |  | 	}() | 
					
						
							| 
									
										
											  
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											
										 
											2016-02-13 07:27:10 +08:00
										 |  |  |  | ) | 
					
						
							| 
									
										
										
										
											2017-05-25 12:09:23 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // Returns minio global information, as a key value map.
 | 
					
						
							|  |  |  |  | // returned list of global values is not an exhaustive
 | 
					
						
							|  |  |  |  | // list. Feel free to add new relevant fields.
 | 
					
						
							|  |  |  |  | func getGlobalInfo() (globalInfo map[string]interface{}) { | 
					
						
							|  |  |  |  | 	globalInfo = map[string]interface{}{ | 
					
						
							|  |  |  |  | 		"isDistXL":         globalIsDistXL, | 
					
						
							|  |  |  |  | 		"isXL":             globalIsXL, | 
					
						
							|  |  |  |  | 		"isBrowserEnabled": globalIsBrowserEnabled, | 
					
						
							| 
									
										
										
										
											2018-06-07 09:10:51 +08:00
										 |  |  |  | 		"isWorm":           globalWORMEnabled, | 
					
						
							| 
									
										
										
										
											2017-05-25 12:09:23 +08:00
										 |  |  |  | 		"isEnvBrowser":     globalIsEnvBrowser, | 
					
						
							|  |  |  |  | 		"isEnvCreds":       globalIsEnvCreds, | 
					
						
							|  |  |  |  | 		"isEnvRegion":      globalIsEnvRegion, | 
					
						
							|  |  |  |  | 		"isSSL":            globalIsSSL, | 
					
						
							|  |  |  |  | 		"serverRegion":     globalServerRegion, | 
					
						
							|  |  |  |  | 		// Add more relevant global settings here.
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	return globalInfo | 
					
						
							|  |  |  |  | } |