| 
									
										
										
										
											2015-12-08 06:12:47 +08:00
										 |  |  |  | /* | 
					
						
							| 
									
										
										
										
											2019-04-10 02:39:42 +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" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  |  | 	"os" | 
					
						
							| 
									
										
										
										
											2016-09-10 06:33:35 +08:00
										 |  |  |  | 	"time" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-15 00:38:05 +08:00
										 |  |  |  | 	"github.com/minio/minio-go/v7/pkg/set" | 
					
						
							| 
									
										
										
										
											2018-05-12 03:02:30 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 10:18:22 +08:00
										 |  |  |  | 	humanize "github.com/dustin/go-humanize" | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	"github.com/minio/minio/cmd/config/cache" | 
					
						
							|  |  |  |  | 	"github.com/minio/minio/cmd/config/compress" | 
					
						
							| 
									
										
										
										
											2019-11-26 08:33:34 +08:00
										 |  |  |  | 	"github.com/minio/minio/cmd/config/etcd/dns" | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	xldap "github.com/minio/minio/cmd/config/identity/ldap" | 
					
						
							|  |  |  |  | 	"github.com/minio/minio/cmd/config/identity/openid" | 
					
						
							|  |  |  |  | 	"github.com/minio/minio/cmd/config/policy/opa" | 
					
						
							|  |  |  |  | 	"github.com/minio/minio/cmd/config/storageclass" | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2020-07-08 10:04:29 +08:00
										 |  |  |  | 	etcd "go.etcd.io/etcd/v3/clientv3" | 
					
						
							| 
									
										
										
										
											2020-05-01 06:55:54 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/certs" | 
					
						
							| 
									
										
										
										
											2019-12-22 14:35:50 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/event" | 
					
						
							| 
									
										
										
										
											2019-06-27 13:41:12 +08:00
										 |  |  |  | 	"github.com/minio/minio/pkg/pubsub" | 
					
						
							| 
									
										
										
										
											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 ( | 
					
						
							| 
									
										
										
										
											2020-05-17 23:46:23 +08:00
										 |  |  |  | 	GlobalMinioDefaultPort = "9000" | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2019-10-02 01:42:18 +08:00
										 |  |  |  | 	globalMacOSName                = "darwin" | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  |  | 	globalMinioModeFS              = "mode-server-fs" | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  |  | 	globalMinioModeErasure         = "mode-server-xl" | 
					
						
							|  |  |  |  | 	globalMinioModeDistErasure     = "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.
 | 
					
						
							| 
									
										
										
										
											2019-03-26 04:41:05 +08:00
										 |  |  |  | 	GlobalMultipartExpiry = time.Hour * 24 * 3 // 3 days.
 | 
					
						
							| 
									
										
										
										
											2019-01-06 06:16:43 +08:00
										 |  |  |  | 	// GlobalMultipartCleanupInterval - Cleanup interval when the stale multipart cleanup is initiated.
 | 
					
						
							|  |  |  |  | 	GlobalMultipartCleanupInterval = time.Hour * 24 // 24 hrs.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-20 04:20:33 +08:00
										 |  |  |  | 	// GlobalServiceExecutionInterval - Executes the Lifecycle events.
 | 
					
						
							|  |  |  |  | 	GlobalServiceExecutionInterval = time.Hour * 24 // 24 hrs.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2020-02-05 17:42:34 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Maximum size of default bucket encryption configuration allowed
 | 
					
						
							|  |  |  |  | 	maxBucketSSEConfigSize = 1 * humanize.MiByte | 
					
						
							| 
									
										
										
										
											2020-06-20 21:36:44 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// diskFillFraction is the fraction of a disk we allow to be filled.
 | 
					
						
							|  |  |  |  | 	diskFillFraction = 0.95 | 
					
						
							| 
									
										
										
										
											2016-11-23 12:13:20 +08:00
										 |  |  |  | ) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | var globalCLIContext = struct { | 
					
						
							| 
									
										
										
										
											2019-05-09 09:35:40 +08:00
										 |  |  |  | 	JSON, Quiet    bool | 
					
						
							|  |  |  |  | 	Anonymous      bool | 
					
						
							|  |  |  |  | 	Addr           string | 
					
						
							|  |  |  |  | 	StrictS3Compat bool | 
					
						
							| 
									
										
										
										
											2018-12-19 08:08:11 +08:00
										 |  |  |  | }{} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-25 08:20:49 +08:00
										 |  |  |  | var ( | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  |  | 	// Indicates set drive count.
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  |  | 	globalErasureSetDriveCount int | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  |  | 	// Indicates if the running minio server is distributed setup.
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  |  | 	globalIsDistErasure = 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.
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  |  | 	globalIsErasure = false | 
					
						
							| 
									
										
										
										
											2017-01-23 16:32:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-04 02:06:13 +08:00
										 |  |  |  | 	// Indicates if the running minio is in gateway mode.
 | 
					
						
							|  |  |  |  | 	globalIsGateway = false | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-15 02:43:43 +08:00
										 |  |  |  | 	// Name of gateway server, e.g S3, GCS, Azure, etc
 | 
					
						
							|  |  |  |  | 	globalGatewayName = "" | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 06:59:53 +08:00
										 |  |  |  | 	// This flag is set to 'true' by default
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	globalBrowserEnabled = true | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-10 02:39:42 +08:00
										 |  |  |  | 	// MinIO local server address (in `host:port` format)
 | 
					
						
							| 
									
										
										
										
											2016-10-12 16:03:50 +08:00
										 |  |  |  | 	globalMinioAddr = "" | 
					
						
							| 
									
										
										
										
											2019-04-10 02:39:42 +08:00
										 |  |  |  | 	// MinIO default port, can be changed through command line.
 | 
					
						
							| 
									
										
										
										
											2020-05-17 23:46:23 +08:00
										 |  |  |  | 	globalMinioPort = GlobalMinioDefaultPort | 
					
						
							| 
									
										
										
										
											2016-10-19 03:49:24 +08:00
										 |  |  |  | 	// Holds the host that was passed using --address
 | 
					
						
							|  |  |  |  | 	globalMinioHost = "" | 
					
						
							| 
									
										
										
										
											2020-04-27 21:25:05 +08:00
										 |  |  |  | 	// Holds the possible host endpoint.
 | 
					
						
							|  |  |  |  | 	globalMinioEndpoint = "" | 
					
						
							| 
									
										
										
										
											2016-12-29 19:13:51 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  |  | 	// globalConfigSys server config system.
 | 
					
						
							|  |  |  |  | 	globalConfigSys *ConfigSys | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-22 14:35:50 +08:00
										 |  |  |  | 	globalNotificationSys  *NotificationSys | 
					
						
							|  |  |  |  | 	globalConfigTargetList *event.TargetList | 
					
						
							| 
									
										
										
										
											2020-03-14 15:01:15 +08:00
										 |  |  |  | 	// globalEnvTargetList has list of targets configured via env.
 | 
					
						
							|  |  |  |  | 	globalEnvTargetList *event.TargetList | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-20 04:53:54 +08:00
										 |  |  |  | 	globalBucketMetadataSys *BucketMetadataSys | 
					
						
							|  |  |  |  | 	globalPolicySys         *PolicySys | 
					
						
							|  |  |  |  | 	globalIAMSys            *IAMSys | 
					
						
							| 
									
										
										
										
											2016-10-12 16:03:50 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-05 17:42:34 +08:00
										 |  |  |  | 	globalLifecycleSys       *LifecycleSys | 
					
						
							|  |  |  |  | 	globalBucketSSEConfigSys *BucketSSEConfigSys | 
					
						
							| 
									
										
										
										
											2019-07-20 04:20:33 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-05 05:58:34 +08:00
										 |  |  |  | 	// globalAPIConfig controls S3 API requests throttling,
 | 
					
						
							|  |  |  |  | 	// healthcheck readiness deadlines and cors settings.
 | 
					
						
							|  |  |  |  | 	globalAPIConfig apiConfig | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	globalStorageClass storageclass.Config | 
					
						
							|  |  |  |  | 	globalLDAPConfig   xldap.Config | 
					
						
							|  |  |  |  | 	globalOpenIDConfig openid.Config | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-09 06:54:41 +08:00
										 |  |  |  | 	// global Trace system to send HTTP request/response logs to
 | 
					
						
							|  |  |  |  | 	// registered listeners
 | 
					
						
							| 
									
										
										
										
											2019-06-27 13:41:12 +08:00
										 |  |  |  | 	globalHTTPTrace = pubsub.New() | 
					
						
							| 
									
										
										
										
											2017-10-25 10:04:51 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-13 02:01:23 +08:00
										 |  |  |  | 	// global Listen system to send S3 API events to registered listeners
 | 
					
						
							|  |  |  |  | 	globalHTTPListen = pubsub.New() | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-04 02:10:48 +08:00
										 |  |  |  | 	// global console system to send console logs to
 | 
					
						
							|  |  |  |  | 	// registered listeners
 | 
					
						
							|  |  |  |  | 	globalConsoleSys *HTTPConsoleLoggerSys | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-20 09:42:27 +08:00
										 |  |  |  | 	globalEndpoints EndpointZones | 
					
						
							| 
									
										
										
										
											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() | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-18 07:37:28 +08:00
										 |  |  |  | 	// Time when the server is started
 | 
					
						
							|  |  |  |  | 	globalBootTime = UTCNow() | 
					
						
							| 
									
										
										
										
											2017-02-08 16:13:02 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  |  | 	globalActiveCred auth.Credentials | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-18 01:36:13 +08:00
										 |  |  |  | 	// Hold the old server credentials passed by the environment
 | 
					
						
							|  |  |  |  | 	globalOldCred auth.Credentials | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-02 06:53:16 +08:00
										 |  |  |  | 	// Indicates if config is to be encrypted
 | 
					
						
							|  |  |  |  | 	globalConfigEncrypted bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 02:17:13 +08:00
										 |  |  |  | 	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
 | 
					
						
							| 
									
										
										
										
											2019-04-10 02:39:42 +08:00
										 |  |  |  | 	globalDomainIPs   set.StringSet // Root domain IP address(s) for a distributed MinIO deployment
 | 
					
						
							| 
									
										
										
										
											2017-09-01 02:29:22 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-13 23:15:26 +08:00
										 |  |  |  | 	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
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-09 04:44:44 +08:00
										 |  |  |  | 	globalBucketObjectLockSys *BucketObjectLockSys | 
					
						
							|  |  |  |  | 	globalBucketQuotaSys      *BucketQuotaSys | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  |  | 	globalBucketVersioningSys *BucketVersioningSys | 
					
						
							| 
									
										
										
										
											2020-05-01 06:55:54 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 	// Disk cache drives
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	globalCacheConfig cache.Config | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-24 01:13:22 +08:00
										 |  |  |  | 	// Initialized KMS configuration for disk cache
 | 
					
						
							|  |  |  |  | 	globalCacheKMS crypto.KMS | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +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
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-30 00:56:45 +08:00
										 |  |  |  | 	// Is set to true when Bucket federation is requested
 | 
					
						
							|  |  |  |  | 	// and is 'true' when etcdConfig.PathPrefix is empty
 | 
					
						
							|  |  |  |  | 	globalBucketFederation bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	// Allocated DNS config wrapper over etcd client.
 | 
					
						
							| 
									
										
										
										
											2020-07-21 03:28:48 +08:00
										 |  |  |  | 	globalDNSConfig dns.Store | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-26 14:08:24 +08:00
										 |  |  |  | 	// Is compression enabled?
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	globalCompressConfig compress.Config | 
					
						
							| 
									
										
										
										
											2018-09-28 11:36:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// Some standard object extensions which we strictly dis-allow for compression.
 | 
					
						
							| 
									
										
										
										
											2019-09-26 14:08:24 +08:00
										 |  |  |  | 	standardExcludeCompressExtensions = []string{".gz", ".bz2", ".rar", ".zip", ".7z", ".xz", ".mp4", ".mkv", ".mov"} | 
					
						
							| 
									
										
										
										
											2018-09-28 11:36:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// 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.
 | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  |  | 	globalOpenIDValidators *openid.Validators | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// OPA policy system.
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 	globalPolicyOPA *opa.Opa | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-29 01:27:49 +08:00
										 |  |  |  | 	globalAllHealState *allHealState | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-09 13:14:07 +08:00
										 |  |  |  | 	// The always present healing routine ready to heal objects
 | 
					
						
							| 
									
										
										
										
											2019-10-29 01:27:49 +08:00
										 |  |  |  | 	globalBackgroundHealRoutine *healRoutine | 
					
						
							|  |  |  |  | 	globalBackgroundHealState   *allHealState | 
					
						
							| 
									
										
										
										
											2019-06-09 13:14:07 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 14:39:09 +08:00
										 |  |  |  | 	// Only enabled when one of the sub-systems fail
 | 
					
						
							|  |  |  |  | 	// to initialize, this allows for administrators to
 | 
					
						
							|  |  |  |  | 	// fix the system.
 | 
					
						
							|  |  |  |  | 	globalSafeMode bool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-13 10:24:59 +08:00
										 |  |  |  | 	// If writes to FS backend should be O_SYNC.
 | 
					
						
							|  |  |  |  | 	globalFSOSync bool | 
					
						
							| 
									
										
										
										
											2020-05-24 08:38:39 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-04 02:53:03 +08:00
										 |  |  |  | 	globalProxyEndpoints []ProxyEndpoint | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |  | 	// Add new variable global values here.
 | 
					
						
							| 
									
										
										
										
											2016-09-10 06:33:35 +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{}{ | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  |  | 		"serverRegion": globalServerRegion, | 
					
						
							| 
									
										
										
										
											2020-05-02 14:55:53 +08:00
										 |  |  |  | 		"domains":      globalDomainNames, | 
					
						
							| 
									
										
										
										
											2017-05-25 12:09:23 +08:00
										 |  |  |  | 		// Add more relevant global settings here.
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	return globalInfo | 
					
						
							|  |  |  |  | } |