| 
									
										
											  
											
												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
										 |  |  | /* | 
					
						
							| 
									
										
										
										
											2019-09-10 07:12:29 +08:00
										 |  |  |  * MinIO Cloud Storage, (C) 2016-2019 MinIO, Inc. | 
					
						
							| 
									
										
											  
											
												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
										 |  |  |  * | 
					
						
							|  |  |  |  * 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 | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	"strings" | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | 	"sync" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config" | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/api" | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/cache" | 
					
						
							|  |  |  | 	"github.com/minio/minio/cmd/config/compress" | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/etcd" | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2019-10-09 14:11:15 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/notify" | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/policy/opa" | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/config/storageclass" | 
					
						
							| 
									
										
										
										
											2018-08-18 03:52:14 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/crypto" | 
					
						
							| 
									
										
										
										
											2019-02-07 04:07:03 +08:00
										 |  |  | 	xhttp "github.com/minio/minio/cmd/http" | 
					
						
							| 
									
										
										
										
											2018-04-20 08:24:43 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/logger" | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/logger/target/http" | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	"github.com/minio/minio/pkg/env" | 
					
						
							| 
									
										
										
										
											2020-01-21 08:48:19 +08:00
										 |  |  | 	"github.com/minio/minio/pkg/madmin" | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | func initHelp() { | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	var kvs = map[string]config.KVS{ | 
					
						
							|  |  |  | 		config.EtcdSubSys:           etcd.DefaultKVS, | 
					
						
							|  |  |  | 		config.CacheSubSys:          cache.DefaultKVS, | 
					
						
							|  |  |  | 		config.CompressionSubSys:    compress.DefaultKVS, | 
					
						
							|  |  |  | 		config.IdentityLDAPSubSys:   xldap.DefaultKVS, | 
					
						
							|  |  |  | 		config.IdentityOpenIDSubSys: openid.DefaultKVS, | 
					
						
							|  |  |  | 		config.PolicyOPASubSys:      opa.DefaultKVS, | 
					
						
							|  |  |  | 		config.RegionSubSys:         config.DefaultRegionKVS, | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 		config.APISubSys:            api.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.CredentialsSubSys:    config.DefaultCredentialKVS, | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 		config.KmsVaultSubSys:       crypto.DefaultVaultKVS, | 
					
						
							|  |  |  | 		config.KmsKesSubSys:         crypto.DefaultKesKVS, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.LoggerWebhookSubSys:  logger.DefaultKVS, | 
					
						
							|  |  |  | 		config.AuditWebhookSubSys:   logger.DefaultAuditKVS, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	for k, v := range notify.DefaultNotificationKVS { | 
					
						
							|  |  |  | 		kvs[k] = v | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  | 	if globalIsErasure { | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 		kvs[config.StorageClassSubSys] = storageclass.DefaultKVS | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	config.RegisterDefaultKVS(kvs) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Captures help for each sub-system
 | 
					
						
							|  |  |  | 	var helpSubSys = config.HelpKVS{ | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.RegionSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "label the location of the server", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.CacheSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "add caching storage tier", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.CompressionSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "enable server side compression of objects", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.EtcdSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "federate multiple clusters for IAM and Bucket DNS", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.IdentityOpenIDSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "enable OpenID SSO support", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.IdentityLDAPSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description: "enable LDAP SSO support", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.PolicyOPASubSys, | 
					
						
							| 
									
										
										
										
											2020-07-29 02:47:57 +08:00
										 |  |  | 			Description: "[DEPRECATED] enable external OPA for policy enforcement", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.KmsVaultSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-07 05:53:51 +08:00
										 |  |  | 			Description: "enable external HashiCorp Vault key management service", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.KmsKesSubSys, | 
					
						
							|  |  |  | 			Description: "enable external MinIO key encryption service", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.APISubSys, | 
					
						
							|  |  |  | 			Description: "manage global HTTP API call specific features, such as throttling, authentication types, etc.", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.LoggerWebhookSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "send server logs to webhook endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.AuditWebhookSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "send audit logs to webhook endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyWebhookSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to webhook endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyAMQPSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to AMQP endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyKafkaSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to Kafka endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyMQTTSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to MQTT endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyNATSSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to NATS endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyNSQSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Description:     "publish bucket notifications to NSQ endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyMySQLSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-07 05:53:51 +08:00
										 |  |  | 			Description:     "publish bucket notifications to MySQL databases", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.NotifyPostgresSubSys, | 
					
						
							| 
									
										
										
										
											2019-12-07 05:53:51 +08:00
										 |  |  | 			Description:     "publish bucket notifications to Postgres databases", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2019-12-07 05:53:51 +08:00
										 |  |  | 			Key:             config.NotifyESSubSys, | 
					
						
							|  |  |  | 			Description:     "publish bucket notifications to Elasticsearch endpoints", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2019-12-07 05:53:51 +08:00
										 |  |  | 			Key:             config.NotifyRedisSubSys, | 
					
						
							|  |  |  | 			Description:     "publish bucket notifications to Redis datastores", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  | 	if globalIsErasure { | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 		helpSubSys = append(helpSubSys, config.HelpKV{}) | 
					
						
							|  |  |  | 		copy(helpSubSys[2:], helpSubSys[1:]) | 
					
						
							|  |  |  | 		helpSubSys[1] = config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.StorageClassSubSys, | 
					
						
							|  |  |  | 			Description: "define object level redundancy", | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	var helpMap = map[string]config.HelpKVS{ | 
					
						
							|  |  |  | 		"":                          helpSubSys, // Help for all sub-systems.
 | 
					
						
							|  |  |  | 		config.RegionSubSys:         config.RegionHelp, | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 		config.APISubSys:            api.Help, | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 		config.StorageClassSubSys:   storageclass.Help, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.EtcdSubSys:           etcd.Help, | 
					
						
							|  |  |  | 		config.CacheSubSys:          cache.Help, | 
					
						
							|  |  |  | 		config.CompressionSubSys:    compress.Help, | 
					
						
							|  |  |  | 		config.IdentityOpenIDSubSys: openid.Help, | 
					
						
							|  |  |  | 		config.IdentityLDAPSubSys:   xldap.Help, | 
					
						
							|  |  |  | 		config.PolicyOPASubSys:      opa.Help, | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 		config.KmsVaultSubSys:       crypto.HelpVault, | 
					
						
							|  |  |  | 		config.KmsKesSubSys:         crypto.HelpKes, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.LoggerWebhookSubSys:  logger.Help, | 
					
						
							|  |  |  | 		config.AuditWebhookSubSys:   logger.HelpAudit, | 
					
						
							|  |  |  | 		config.NotifyAMQPSubSys:     notify.HelpAMQP, | 
					
						
							|  |  |  | 		config.NotifyKafkaSubSys:    notify.HelpKafka, | 
					
						
							|  |  |  | 		config.NotifyMQTTSubSys:     notify.HelpMQTT, | 
					
						
							|  |  |  | 		config.NotifyNATSSubSys:     notify.HelpNATS, | 
					
						
							|  |  |  | 		config.NotifyNSQSubSys:      notify.HelpNSQ, | 
					
						
							|  |  |  | 		config.NotifyMySQLSubSys:    notify.HelpMySQL, | 
					
						
							|  |  |  | 		config.NotifyPostgresSubSys: notify.HelpPostgres, | 
					
						
							|  |  |  | 		config.NotifyRedisSubSys:    notify.HelpRedis, | 
					
						
							|  |  |  | 		config.NotifyWebhookSubSys:  notify.HelpWebhook, | 
					
						
							|  |  |  | 		config.NotifyESSubSys:       notify.HelpES, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	config.RegisterHelpSubSys(helpMap) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | var ( | 
					
						
							| 
									
										
										
										
											2017-11-30 05:12:47 +08:00
										 |  |  | 	// globalServerConfig server config.
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalServerConfig   config.Config | 
					
						
							| 
									
										
										
										
											2017-11-30 05:12:47 +08:00
										 |  |  | 	globalServerConfigMu sync.RWMutex | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-06 04:31:12 +08:00
										 |  |  | func validateConfig(s config.Config, setDriveCount int) error { | 
					
						
							| 
									
										
										
										
											2019-10-31 14:39:09 +08:00
										 |  |  | 	// Disable merging env values with config for validation.
 | 
					
						
							|  |  |  | 	env.SetEnvOff() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 	// Enable env values to validate KMS.
 | 
					
						
							| 
									
										
										
										
											2019-10-31 14:39:09 +08:00
										 |  |  | 	defer env.SetEnvOn() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := config.LookupCreds(s[config.CredentialsSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-08-20 04:57:18 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := config.LookupRegion(s[config.RegionSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 	if _, err := api.LookupConfig(s[config.APISubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  | 	if globalIsErasure { | 
					
						
							| 
									
										
										
										
											2020-08-06 04:31:12 +08:00
										 |  |  | 		if _, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount); err != nil { | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 			return err | 
					
						
							| 
									
										
										
										
											2018-08-20 04:57:18 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := cache.LookupConfig(s[config.CacheSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-08-20 04:57:18 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := compress.LookupConfig(s[config.CompressionSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		etcdCfg, err := etcd.LookupConfig(s[config.EtcdSubSys][config.Default], globalRootCAs) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if etcdCfg.Enabled { | 
					
						
							|  |  |  | 			etcdClnt, err := etcd.New(etcdCfg) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			etcdClnt.Close() | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 		kmsCfg, err := crypto.LookupConfig(s, globalCertsCADir.Get(), NewGatewayHTTPTransport()) | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 		// Set env to enable master key validation.
 | 
					
						
							|  |  |  | 		// this is needed only for KMS.
 | 
					
						
							|  |  |  | 		env.SetEnvOn() | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 		if _, err = crypto.NewKMS(kmsCfg); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-12-14 04:57:11 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Disable merging env values for the rest.
 | 
					
						
							|  |  |  | 		env.SetEnvOff() | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := openid.LookupConfig(s[config.IdentityOpenIDSubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 		NewGatewayHTTPTransport(), xhttp.DrainBody); err != nil { | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-22 13:47:26 +08:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		cfg, err := xldap.Lookup(s[config.IdentityLDAPSubSys][config.Default], | 
					
						
							|  |  |  | 			globalRootCAs) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if cfg.Enabled { | 
					
						
							|  |  |  | 			conn, cerr := cfg.Connect() | 
					
						
							|  |  |  | 			if cerr != nil { | 
					
						
							|  |  |  | 				return cerr | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			conn.Close() | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := opa.LookupConfig(s[config.PolicyOPASubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 		NewGatewayHTTPTransport(), xhttp.DrainBody); err != nil { | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if _, err := logger.LookupConfig(s); err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-17 01:56:18 +08:00
										 |  |  | 	return notify.TestNotificationTargets(s, GlobalContext.Done(), NewGatewayHTTPTransport(), | 
					
						
							| 
									
										
										
										
											2019-12-14 04:36:45 +08:00
										 |  |  | 		globalNotificationSys.ConfiguredTargetIDs()) | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-06 04:31:12 +08:00
										 |  |  | func lookupConfigs(s config.Config, setDriveCount int) { | 
					
						
							| 
									
										
										
										
											2020-04-10 00:30:02 +08:00
										 |  |  | 	ctx := GlobalContext | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	var err error | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if !globalActiveCred.IsValid() { | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 		// Env doesn't seem to be set, we fallback to lookup creds from the config.
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 		globalActiveCred, err = config.LookupCreds(s[config.CredentialsSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Invalid credentials configuration: %w", err)) | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-19 07:19:29 +08:00
										 |  |  | 	etcdCfg, err := etcd.LookupConfig(s[config.EtcdSubSys][config.Default], globalRootCAs) | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2020-06-16 13:09:39 +08:00
										 |  |  | 		if globalIsGateway { | 
					
						
							|  |  |  | 			logger.FatalIf(err, "Unable to initialize etcd config") | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err)) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 	if etcdCfg.Enabled { | 
					
						
							| 
									
										
										
										
											2020-06-19 08:31:56 +08:00
										 |  |  | 		if globalEtcdClient == nil { | 
					
						
							|  |  |  | 			globalEtcdClient, err = etcd.New(etcdCfg) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				if globalIsGateway { | 
					
						
							|  |  |  | 					logger.FatalIf(err, "Unable to initialize etcd config") | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err)) | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-06-17 11:15:21 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-06-19 08:31:56 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil && globalDNSConfig == nil { | 
					
						
							| 
									
										
										
										
											2020-06-17 11:15:21 +08:00
										 |  |  | 			globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config, | 
					
						
							|  |  |  | 				dns.DomainNames(globalDomainNames), | 
					
						
							|  |  |  | 				dns.DomainIPs(globalDomainIPs), | 
					
						
							|  |  |  | 				dns.DomainPort(globalMinioPort), | 
					
						
							|  |  |  | 				dns.CoreDNSPath(etcdCfg.CoreDNSPath), | 
					
						
							|  |  |  | 			) | 
					
						
							| 
									
										
										
										
											2020-06-16 13:09:39 +08:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				if globalIsGateway { | 
					
						
							| 
									
										
										
										
											2020-06-17 11:15:21 +08:00
										 |  |  | 					logger.FatalIf(err, "Unable to initialize DNS config") | 
					
						
							| 
									
										
										
										
											2020-06-16 13:09:39 +08:00
										 |  |  | 				} else { | 
					
						
							| 
									
										
										
										
											2020-06-17 11:15:21 +08:00
										 |  |  | 					logger.LogIf(ctx, fmt.Errorf("Unable to initialize DNS config for %s: %w", | 
					
						
							|  |  |  | 						globalDomainNames, err)) | 
					
						
							| 
									
										
										
										
											2020-06-16 13:09:39 +08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-06-17 11:15:21 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-30 00:56:45 +08:00
										 |  |  | 	// Bucket federation is 'true' only when IAM assets are not namespaced
 | 
					
						
							|  |  |  | 	// per tenant and all tenants interested in globally available users
 | 
					
						
							|  |  |  | 	// if namespace was requested such as specifying etcdPathPrefix then
 | 
					
						
							|  |  |  | 	// we assume that users are interested in global bucket support
 | 
					
						
							|  |  |  | 	// but not federation.
 | 
					
						
							|  |  |  | 	globalBucketFederation = etcdCfg.PathPrefix == "" && etcdCfg.Enabled | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalServerRegion, err = config.LookupRegion(s[config.RegionSubSys][config.Default]) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Invalid region configuration: %w", err)) | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 	apiConfig, err := api.LookupConfig(s[config.APISubSys][config.Default]) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		logger.LogIf(ctx, fmt.Errorf("Invalid api configuration: %w", err)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-05 05:58:34 +08:00
										 |  |  | 	globalAPIConfig.init(apiConfig) | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  | 	if globalIsErasure { | 
					
						
							| 
									
										
										
										
											2020-08-06 04:31:12 +08:00
										 |  |  | 		globalStorageClass, err = storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to initialize storage class config: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-04-05 23:18:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalCacheConfig, err = cache.LookupConfig(s[config.CacheSubSys][config.Default]) | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2020-06-16 13:09:39 +08:00
										 |  |  | 		if globalIsGateway { | 
					
						
							|  |  |  | 			logger.FatalIf(err, "Unable to setup cache") | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to setup cache: %w", err)) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-08-18 03:52:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if globalCacheConfig.Enabled { | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 		if cacheEncKey := env.Get(cache.EnvCacheEncryptionMasterKey, ""); cacheEncKey != "" { | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 			globalCacheKMS, err = crypto.ParseMasterKey(cacheEncKey) | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 			if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 				logger.LogIf(ctx, fmt.Errorf("Unable to setup encryption cache: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-08-18 03:52:14 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-09-28 11:36:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 	kmsCfg, err := crypto.LookupConfig(s, globalCertsCADir.Get(), NewGatewayHTTPTransport()) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to setup KMS config: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	GlobalKMS, err = crypto.NewKMS(kmsCfg) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to setup KMS with current KMS config: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	// Enable auto-encryption if enabled
 | 
					
						
							|  |  |  | 	globalAutoEncryption = kmsCfg.AutoEncryption | 
					
						
							| 
									
										
										
										
											2018-10-13 02:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalCompressConfig, err = compress.LookupConfig(s[config.CompressionSubSys][config.Default]) | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to setup Compression: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-05 01:35:33 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalOpenIDConfig, err = openid.LookupConfig(s[config.IdentityOpenIDSubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 		NewGatewayHTTPTransport(), xhttp.DrainBody) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize OpenID: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	opaCfg, err := opa.LookupConfig(s[config.PolicyOPASubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 		NewGatewayHTTPTransport(), xhttp.DrainBody) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize OPA: %w", err)) | 
					
						
							| 
									
										
										
										
											2018-10-13 02:32:18 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-09-10 07:12:29 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalOpenIDValidators = getOpenIDValidators(globalOpenIDConfig) | 
					
						
							|  |  |  | 	globalPolicyOPA = opa.New(opaCfg) | 
					
						
							| 
									
										
										
										
											2019-10-07 13:50:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	globalLDAPConfig, err = xldap.Lookup(s[config.IdentityLDAPSubSys][config.Default], | 
					
						
							|  |  |  | 		globalRootCAs) | 
					
						
							| 
									
										
										
										
											2019-09-10 07:12:29 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to parse LDAP configuration: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-09-10 07:12:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Load logger targets based on user's configuration
 | 
					
						
							|  |  |  | 	loggerUserAgent := getUserAgent(getMinioMode()) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	loggerCfg, err := logger.LookupConfig(s) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize logger: %w", err)) | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	for _, l := range loggerCfg.HTTP { | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 		if l.Enabled { | 
					
						
							|  |  |  | 			// Enable http logging
 | 
					
						
							| 
									
										
										
										
											2020-08-17 01:25:00 +08:00
										 |  |  | 			if err = logger.AddTarget( | 
					
						
							| 
									
										
										
										
											2020-04-02 11:53:07 +08:00
										 |  |  | 				http.New(http.WithEndpoint(l.Endpoint), | 
					
						
							|  |  |  | 					http.WithAuthToken(l.AuthToken), | 
					
						
							|  |  |  | 					http.WithUserAgent(loggerUserAgent), | 
					
						
							|  |  |  | 					http.WithLogKind(string(logger.All)), | 
					
						
							|  |  |  | 					http.WithTransport(NewGatewayHTTPTransport()), | 
					
						
							|  |  |  | 				), | 
					
						
							| 
									
										
										
										
											2020-08-17 01:25:00 +08:00
										 |  |  | 			); err != nil { | 
					
						
							|  |  |  | 				logger.LogIf(ctx, fmt.Errorf("Unable to initialize console HTTP target: %w", err)) | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	for _, l := range loggerCfg.Audit { | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 		if l.Enabled { | 
					
						
							|  |  |  | 			// Enable http audit logging
 | 
					
						
							| 
									
										
										
										
											2020-08-17 01:25:00 +08:00
										 |  |  | 			if err = logger.AddAuditTarget( | 
					
						
							| 
									
										
										
										
											2020-04-02 11:53:07 +08:00
										 |  |  | 				http.New(http.WithEndpoint(l.Endpoint), | 
					
						
							|  |  |  | 					http.WithAuthToken(l.AuthToken), | 
					
						
							|  |  |  | 					http.WithUserAgent(loggerUserAgent), | 
					
						
							|  |  |  | 					http.WithLogKind(string(logger.All)), | 
					
						
							|  |  |  | 					http.WithTransport(NewGatewayHTTPTransport()), | 
					
						
							|  |  |  | 				), | 
					
						
							| 
									
										
										
										
											2020-08-17 01:25:00 +08:00
										 |  |  | 			); err != nil { | 
					
						
							|  |  |  | 				logger.LogIf(ctx, fmt.Errorf("Unable to initialize audit HTTP target: %w", err)) | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-10-08 13:47:56 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-12-22 14:35:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-25 18:29:28 +08:00
										 |  |  | 	globalConfigTargetList, err = notify.GetNotificationTargets(s, GlobalContext.Done(), NewGatewayHTTPTransport(), false) | 
					
						
							| 
									
										
										
										
											2019-12-22 14:35:50 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err)) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-03-22 13:10:13 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-25 18:29:28 +08:00
										 |  |  | 	globalEnvTargetList, err = notify.GetNotificationTargets(newServerConfig(), GlobalContext.Done(), NewGatewayHTTPTransport(), true) | 
					
						
							| 
									
										
										
										
											2020-03-14 15:01:15 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err)) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | // Help - return sub-system level help
 | 
					
						
							|  |  |  | type Help struct { | 
					
						
							|  |  |  | 	SubSys          string         `json:"subSys"` | 
					
						
							|  |  |  | 	Description     string         `json:"description"` | 
					
						
							|  |  |  | 	MultipleTargets bool           `json:"multipleTargets"` | 
					
						
							|  |  |  | 	KeysHelp        config.HelpKVS `json:"keysHelp"` | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | // GetHelp - returns help for sub-sys, a key for a sub-system or all the help.
 | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | func GetHelp(subSys, key string, envOnly bool) (Help, error) { | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if len(subSys) == 0 { | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		return Help{KeysHelp: config.HelpSubSysMap[subSys]}, nil | 
					
						
							| 
									
										
										
										
											2018-09-06 23:03:18 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	subSystemValue := strings.SplitN(subSys, config.SubSystemSeparator, 2) | 
					
						
							|  |  |  | 	if len(subSystemValue) == 0 { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		return Help{}, config.Errorf("invalid number of arguments %s", subSys) | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	subSys = subSystemValue[0] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	subSysHelp, ok := config.HelpSubSysMap[""].Lookup(subSys) | 
					
						
							|  |  |  | 	if !ok { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		return Help{}, config.Errorf("unknown sub-system %s", subSys) | 
					
						
							| 
									
										
										
										
											2018-09-06 23:03:18 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	h, ok := config.HelpSubSysMap[subSys] | 
					
						
							|  |  |  | 	if !ok { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 		return Help{}, config.Errorf("unknown sub-system %s", subSys) | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if key != "" { | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 		value, ok := h.Lookup(key) | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 		if !ok { | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 			return Help{}, config.Errorf("unknown key %s for sub-system %s", | 
					
						
							|  |  |  | 				key, subSys) | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 		h = config.HelpKVS{value} | 
					
						
							| 
									
										
										
										
											2018-11-08 02:23:13 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 	envHelp := config.HelpKVS{} | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 	if envOnly { | 
					
						
							| 
									
										
										
										
											2020-01-21 08:48:19 +08:00
										 |  |  | 		// Only for multiple targets, make sure
 | 
					
						
							|  |  |  | 		// to list the ENV, for regular k/v EnableKey is
 | 
					
						
							|  |  |  | 		// implicit, for ENVs we cannot make it implicit.
 | 
					
						
							|  |  |  | 		if subSysHelp.MultipleTargets { | 
					
						
							|  |  |  | 			envK := config.EnvPrefix + strings.Join([]string{ | 
					
						
							|  |  |  | 				strings.ToTitle(subSys), strings.ToTitle(madmin.EnableKey), | 
					
						
							|  |  |  | 			}, config.EnvWordDelimiter) | 
					
						
							|  |  |  | 			envHelp = append(envHelp, config.HelpKV{ | 
					
						
							|  |  |  | 				Key:         envK, | 
					
						
							|  |  |  | 				Description: fmt.Sprintf("enable %s target, default is 'off'", subSys), | 
					
						
							|  |  |  | 				Optional:    false, | 
					
						
							|  |  |  | 				Type:        "on|off", | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 		for _, hkv := range h { | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 			envK := config.EnvPrefix + strings.Join([]string{ | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 				strings.ToTitle(subSys), strings.ToTitle(hkv.Key), | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 			}, config.EnvWordDelimiter) | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 			envHelp = append(envHelp, config.HelpKV{ | 
					
						
							|  |  |  | 				Key:         envK, | 
					
						
							|  |  |  | 				Description: hkv.Description, | 
					
						
							|  |  |  | 				Optional:    hkv.Optional, | 
					
						
							|  |  |  | 				Type:        hkv.Type, | 
					
						
							|  |  |  | 			}) | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 		h = envHelp | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return Help{ | 
					
						
							|  |  |  | 		SubSys:          subSys, | 
					
						
							|  |  |  | 		Description:     subSysHelp.Description, | 
					
						
							|  |  |  | 		MultipleTargets: subSysHelp.MultipleTargets, | 
					
						
							|  |  |  | 		KeysHelp:        h, | 
					
						
							|  |  |  | 	}, nil | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-09-06 23:03:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | func newServerConfig() config.Config { | 
					
						
							| 
									
										
										
										
											2019-11-14 09:38:05 +08:00
										 |  |  | 	return config.New() | 
					
						
							| 
									
										
										
										
											2017-03-02 01:17:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  | // newSrvConfig - initialize a new server config, saves env parameters if
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | // found, otherwise use default parameters
 | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  | func newSrvConfig(objAPI ObjectLayer) error { | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	// Initialize server config.
 | 
					
						
							|  |  |  | 	srvCfg := newServerConfig() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-08 04:51:43 +08:00
										 |  |  | 	// hold the mutex lock before a new config is assigned.
 | 
					
						
							| 
									
										
										
										
											2017-11-30 05:12:47 +08:00
										 |  |  | 	globalServerConfigMu.Lock() | 
					
						
							|  |  |  | 	globalServerConfig = srvCfg | 
					
						
							|  |  |  | 	globalServerConfigMu.Unlock() | 
					
						
							| 
									
										
										
										
											2017-02-08 04:51:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Save config into file.
 | 
					
						
							| 
									
										
										
										
											2020-04-10 00:30:02 +08:00
										 |  |  | 	return saveServerConfig(GlobalContext, objAPI, globalServerConfig) | 
					
						
							| 
									
										
										
										
											2017-02-08 04:51:43 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | func getValidConfig(objAPI ObjectLayer) (config.Config, error) { | 
					
						
							| 
									
										
										
										
											2020-04-10 00:30:02 +08:00
										 |  |  | 	return readServerConfig(GlobalContext, objAPI) | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | // loadConfig - loads a new config from disk, overrides params
 | 
					
						
							|  |  |  | // from env if found and valid
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | func loadConfig(objAPI ObjectLayer) error { | 
					
						
							|  |  |  | 	srvCfg, err := getValidConfig(objAPI) | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2017-03-17 02:06:17 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-12-07 19:41:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	// Override any values from ENVs.
 | 
					
						
							| 
									
										
										
										
											2020-08-06 04:31:12 +08:00
										 |  |  | 	lookupConfigs(srvCfg, objAPI.SetDriveCount()) | 
					
						
							| 
									
										
										
										
											2018-03-30 05:38:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 13:26:24 +08:00
										 |  |  | 	// hold the mutex lock before a new config is assigned.
 | 
					
						
							| 
									
										
										
										
											2017-11-30 05:12:47 +08:00
										 |  |  | 	globalServerConfigMu.Lock() | 
					
						
							|  |  |  | 	globalServerConfig = srvCfg | 
					
						
							|  |  |  | 	globalServerConfigMu.Unlock() | 
					
						
							| 
									
										
											  
											
												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-03-31 13:26:24 +08:00
										 |  |  | 	return nil | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-03-16 04:03:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 06:07:20 +08:00
										 |  |  | // getOpenIDValidators - returns ValidatorList which contains
 | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  | // enabled providers in server config.
 | 
					
						
							|  |  |  | // A new authentication provider is added like below
 | 
					
						
							| 
									
										
										
										
											2019-10-02 06:07:20 +08:00
										 |  |  | // * Add a new provider in pkg/iam/openid package.
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | func getOpenIDValidators(cfg openid.Config) *openid.Validators { | 
					
						
							| 
									
										
										
										
											2019-10-02 06:07:20 +08:00
										 |  |  | 	validators := openid.NewValidators() | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if cfg.JWKS.URL != nil { | 
					
						
							|  |  |  | 		validators.Add(openid.NewJWT(cfg)) | 
					
						
							| 
									
										
										
										
											2018-10-10 05:00:01 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return validators | 
					
						
							|  |  |  | } |