| 
									
										
										
										
											2021-04-19 03:41:13 +08:00
										 |  |  | // Copyright (c) 2015-2021 MinIO, Inc.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This file is part of MinIO Object Storage stack
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This program is free software: you can redistribute it and/or modify
 | 
					
						
							|  |  |  | // it under the terms of the GNU Affero General Public License as published by
 | 
					
						
							|  |  |  | // the Free Software Foundation, either version 3 of the License, or
 | 
					
						
							|  |  |  | // (at your option) any later version.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					
						
							|  |  |  | // GNU Affero General Public License for more details.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU Affero General Public License
 | 
					
						
							|  |  |  | // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							| 
									
										
											  
											
												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-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 ( | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 	"context" | 
					
						
							| 
									
										
										
										
											2021-04-22 23:45:30 +08:00
										 |  |  | 	"errors" | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/browser" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-20 08:53:08 +08:00
										 |  |  | 	"github.com/minio/madmin-go/v3" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/api" | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/batch" | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/cache" | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/callhome" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/compress" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/dns" | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/drive" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/etcd" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/heal" | 
					
						
							|  |  |  | 	xldap "github.com/minio/minio/internal/config/identity/ldap" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/identity/openid" | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 	idplugin "github.com/minio/minio/internal/config/identity/plugin" | 
					
						
							| 
									
										
										
										
											2021-09-08 10:03:48 +08:00
										 |  |  | 	xtls "github.com/minio/minio/internal/config/identity/tls" | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/lambda" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/notify" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/policy/opa" | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 	polplugin "github.com/minio/minio/internal/config/policy/plugin" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/scanner" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/config/storageclass" | 
					
						
							| 
									
										
										
										
											2021-09-15 12:54:25 +08:00
										 |  |  | 	"github.com/minio/minio/internal/config/subnet" | 
					
						
							| 
									
										
										
										
											2021-06-02 05:59:40 +08:00
										 |  |  | 	"github.com/minio/minio/internal/crypto" | 
					
						
							|  |  |  | 	xhttp "github.com/minio/minio/internal/http" | 
					
						
							|  |  |  | 	"github.com/minio/minio/internal/logger" | 
					
						
							| 
									
										
										
										
											2023-09-05 03:57:37 +08:00
										 |  |  | 	"github.com/minio/pkg/v2/env" | 
					
						
							| 
									
										
											  
											
												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() { | 
					
						
							| 
									
										
										
										
											2022-01-03 01:15:06 +08:00
										 |  |  | 	kvs := map[string]config.KVS{ | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.EtcdSubSys:           etcd.DefaultKVS, | 
					
						
							|  |  |  | 		config.CompressionSubSys:    compress.DefaultKVS, | 
					
						
							|  |  |  | 		config.IdentityLDAPSubSys:   xldap.DefaultKVS, | 
					
						
							|  |  |  | 		config.IdentityOpenIDSubSys: openid.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2021-09-08 10:03:48 +08:00
										 |  |  | 		config.IdentityTLSSubSys:    xtls.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 		config.IdentityPluginSubSys: idplugin.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.PolicyOPASubSys:      opa.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 		config.PolicyPluginSubSys:   polplugin.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 		config.SiteSubSys:           config.DefaultSiteKVS, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.RegionSubSys:         config.DefaultRegionKVS, | 
					
						
							| 
									
										
										
										
											2020-04-15 03:46:37 +08:00
										 |  |  | 		config.APISubSys:            api.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2021-12-21 05:16:53 +08:00
										 |  |  | 		config.LoggerWebhookSubSys:  logger.DefaultLoggerWebhookKVS, | 
					
						
							| 
									
										
										
										
											2021-07-14 00:39:13 +08:00
										 |  |  | 		config.AuditWebhookSubSys:   logger.DefaultAuditWebhookKVS, | 
					
						
							|  |  |  | 		config.AuditKafkaSubSys:     logger.DefaultAuditKafkaKVS, | 
					
						
							| 
									
										
										
										
											2021-02-18 04:04:11 +08:00
										 |  |  | 		config.ScannerSubSys:        scanner.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2021-09-15 12:54:25 +08:00
										 |  |  | 		config.SubnetSubSys:         subnet.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 		config.CallhomeSubSys:       callhome.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 		config.DriveSubSys:          drive.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 		config.CacheSubSys:          cache.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 		config.BatchSubSys:          batch.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 		config.BrowserSubSys:        browser.DefaultKVS, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	for k, v := range notify.DefaultNotificationKVS { | 
					
						
							|  |  |  | 		kvs[k] = v | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 	for k, v := range lambda.DefaultLambdaKVS { | 
					
						
							|  |  |  | 		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 | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 		kvs[config.HealSubSys] = heal.DefaultKVS | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	config.RegisterDefaultKVS(kvs) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Captures help for each sub-system
 | 
					
						
							| 
									
										
										
										
											2022-01-03 01:15:06 +08:00
										 |  |  | 	helpSubSys := config.HelpKVS{ | 
					
						
							| 
									
										
										
										
											2022-12-01 23:50:08 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.SubnetSubSys, | 
					
						
							|  |  |  | 			Type:        "string", | 
					
						
							|  |  |  | 			Description: "register the cluster to MinIO SUBNET", | 
					
						
							|  |  |  | 			Optional:    true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.CallhomeSubSys, | 
					
						
							|  |  |  | 			Type:        "string", | 
					
						
							|  |  |  | 			Description: "enable callhome to MinIO SUBNET", | 
					
						
							|  |  |  | 			Optional:    true, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.DriveSubSys, | 
					
						
							|  |  |  | 			Description: "enable drive specific settings", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 			Key:         config.SiteSubSys, | 
					
						
							|  |  |  | 			Description: "label the server and its location", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2022-12-01 23:50:08 +08:00
										 |  |  | 			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{ | 
					
						
							| 
									
										
										
										
											2022-12-01 23:50:08 +08:00
										 |  |  | 			Key:         config.ScannerSubSys, | 
					
						
							|  |  |  | 			Description: "manage namespace scanning for usage calculation, lifecycle, healing and more", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.BatchSubSys, | 
					
						
							|  |  |  | 			Description: "manage batch job workers and wait times", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2022-12-01 23:50:08 +08:00
										 |  |  | 			Key:         config.CompressionSubSys, | 
					
						
							|  |  |  | 			Description: "enable server side compression of objects", | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2022-04-29 09:27:09 +08:00
										 |  |  | 			Key:             config.IdentityOpenIDSubSys, | 
					
						
							|  |  |  | 			Description:     "enable OpenID SSO support", | 
					
						
							|  |  |  | 			MultipleTargets: true, | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-09-08 10:03:48 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.IdentityTLSSubSys, | 
					
						
							|  |  |  | 			Description: "enable X.509 TLS certificate SSO support", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.IdentityPluginSubSys, | 
					
						
							|  |  |  | 			Description: "enable Identity Plugin via external hook", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 			Key:         config.PolicyPluginSubSys, | 
					
						
							|  |  |  | 			Description: "enable Access Management Plugin for policy enforcement", | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-07-14 00:39:13 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.AuditKafkaSubSys, | 
					
						
							|  |  |  | 			Description:     "send audit logs to kafka endpoints", | 
					
						
							|  |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		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, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:             config.LambdaWebhookSubSys, | 
					
						
							|  |  |  | 			Description:     "manage remote lambda functions", | 
					
						
							|  |  |  | 			MultipleTargets: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-09-15 12:54:25 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2022-12-01 23:50:08 +08:00
										 |  |  | 			Key:         config.EtcdSubSys, | 
					
						
							|  |  |  | 			Description: "persist IAM assets externally to etcd", | 
					
						
							| 
									
										
										
										
											2021-09-15 12:54:25 +08:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.CacheSubSys, | 
					
						
							|  |  |  | 			Type:        "string", | 
					
						
							| 
									
										
										
										
											2023-12-22 08:57:13 +08:00
										 |  |  | 			Description: "enable cache plugin on MinIO for GET/HEAD requests", | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 			Optional:    true, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 		config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.BrowserSubSys, | 
					
						
							|  |  |  | 			Description: "manage Browser HTTP specific features, such as Security headers, etc.", | 
					
						
							|  |  |  | 			Optional:    true, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-13 11:04:01 +08:00
										 |  |  | 	if globalIsErasure { | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 		helpSubSys = append(helpSubSys, config.HelpKV{ | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 			Key:         config.StorageClassSubSys, | 
					
						
							|  |  |  | 			Description: "define object level redundancy", | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 		}, config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         config.HealSubSys, | 
					
						
							|  |  |  | 			Description: "manage object healing frequency and bitrot verification checks", | 
					
						
							|  |  |  | 		}) | 
					
						
							| 
									
										
										
										
											2019-12-05 07:32:37 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-03 01:15:06 +08:00
										 |  |  | 	helpMap := map[string]config.HelpKVS{ | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		"":                          helpSubSys, // Help for all sub-systems.
 | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 		config.SiteSubSys:           config.SiteHelp, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		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.CompressionSubSys:    compress.Help, | 
					
						
							| 
									
										
										
										
											2020-10-15 04:51:51 +08:00
										 |  |  | 		config.HealSubSys:           heal.Help, | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 		config.BatchSubSys:          batch.Help, | 
					
						
							| 
									
										
										
										
											2021-02-18 04:04:11 +08:00
										 |  |  | 		config.ScannerSubSys:        scanner.Help, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.IdentityOpenIDSubSys: openid.Help, | 
					
						
							|  |  |  | 		config.IdentityLDAPSubSys:   xldap.Help, | 
					
						
							| 
									
										
										
										
											2021-09-08 10:03:48 +08:00
										 |  |  | 		config.IdentityTLSSubSys:    xtls.Help, | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 		config.IdentityPluginSubSys: idplugin.Help, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.PolicyOPASubSys:      opa.Help, | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 		config.PolicyPluginSubSys:   polplugin.Help, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		config.LoggerWebhookSubSys:  logger.Help, | 
					
						
							| 
									
										
										
										
											2021-07-14 00:39:13 +08:00
										 |  |  | 		config.AuditWebhookSubSys:   logger.HelpWebhook, | 
					
						
							|  |  |  | 		config.AuditKafkaSubSys:     logger.HelpKafka, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 		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, | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 		config.LambdaWebhookSubSys:  lambda.HelpWebhook, | 
					
						
							| 
									
										
										
										
											2021-12-04 01:32:11 +08:00
										 |  |  | 		config.SubnetSubSys:         subnet.HelpSubnet, | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 		config.CallhomeSubSys:       callhome.HelpCallhome, | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 		config.DriveSubSys:          drive.HelpDrive, | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 		config.CacheSubSys:          cache.Help, | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 		config.BrowserSubSys:        browser.Help, | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	config.RegisterHelpSubSys(helpMap) | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// save top-level help for deprecated sub-systems in a separate map.
 | 
					
						
							|  |  |  | 	deprecatedHelpKVMap := map[string]config.HelpKV{ | 
					
						
							|  |  |  | 		config.RegionSubSys: { | 
					
						
							|  |  |  | 			Key:         config.RegionSubSys, | 
					
						
							|  |  |  | 			Description: "[DEPRECATED - use `site` instead] label the location of the server", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 		config.PolicyOPASubSys: { | 
					
						
							|  |  |  | 			Key:         config.PolicyOPASubSys, | 
					
						
							|  |  |  | 			Description: "[DEPRECATED - use `policy_plugin` instead] enable external OPA for policy enforcement", | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	config.RegisterHelpDeprecatedSubSys(deprecatedHelpKVMap) | 
					
						
							| 
									
										
										
										
											2019-11-28 01:36:08 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-25 13:57:37 +08:00
										 |  |  | func validateSubSysConfig(ctx context.Context, s config.Config, subSys string, objAPI ObjectLayer) error { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	switch subSys { | 
					
						
							|  |  |  | 	case config.SiteSubSys: | 
					
						
							|  |  |  | 		if _, err := config.LookupSite(s[config.SiteSubSys][config.Default], s[config.RegionSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case config.APISubSys: | 
					
						
							|  |  |  | 		if _, err := api.LookupConfig(s[config.APISubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 	case config.BatchSubSys: | 
					
						
							|  |  |  | 		if _, err := batch.LookupConfig(s[config.BatchSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.StorageClassSubSys: | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 		if objAPI == nil { | 
					
						
							|  |  |  | 			return errServerNotInitialized | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for _, setDriveCount := range objAPI.SetDriveCounts() { | 
					
						
							|  |  |  | 			if _, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount); err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							| 
									
										
										
										
											2021-01-23 04:09:24 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-08-20 04:57:18 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.CompressionSubSys: | 
					
						
							| 
									
										
										
										
											2023-01-17 22:07:47 +08:00
										 |  |  | 		if _, err := compress.LookupConfig(s[config.CompressionSubSys][config.Default]); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.HealSubSys: | 
					
						
							|  |  |  | 		if _, err := heal.LookupConfig(s[config.HealSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case config.ScannerSubSys: | 
					
						
							|  |  |  | 		if _, err := scanner.LookupConfig(s[config.ScannerSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case config.EtcdSubSys: | 
					
						
							| 
									
										
										
										
											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() | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.IdentityOpenIDSubSys: | 
					
						
							| 
									
										
										
										
											2022-06-18 02:39:21 +08:00
										 |  |  | 		if _, err := openid.LookupConfig(s, | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 			NewHTTPTransport(), xhttp.DrainBody, globalSite.Region); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case config.IdentityLDAPSubSys: | 
					
						
							| 
									
										
										
										
											2022-10-08 13:12:36 +08:00
										 |  |  | 		cfg, err := xldap.Lookup(s, globalRootCAs) | 
					
						
							| 
									
										
										
										
											2020-03-22 13:47:26 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-10-08 13:12:36 +08:00
										 |  |  | 		if cfg.Enabled() { | 
					
						
							|  |  |  | 			conn, cerr := cfg.LDAP.Connect() | 
					
						
							| 
									
										
										
										
											2020-03-22 13:47:26 +08:00
										 |  |  | 			if cerr != nil { | 
					
						
							|  |  |  | 				return cerr | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			conn.Close() | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.IdentityTLSSubSys: | 
					
						
							|  |  |  | 		if _, err := xtls.Lookup(s[config.IdentityTLSSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 	case config.IdentityPluginSubSys: | 
					
						
							|  |  |  | 		if _, err := idplugin.LookupConfig(s[config.IdentityPluginSubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 			NewHTTPTransport(), xhttp.DrainBody, globalSite.Region); err != nil { | 
					
						
							| 
									
										
										
										
											2022-05-27 08:58:09 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.SubnetSubSys: | 
					
						
							| 
									
										
										
										
											2022-06-27 18:58:25 +08:00
										 |  |  | 		if _, err := subnet.LookupConfig(s[config.SubnetSubSys][config.Default], nil); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 	case config.CallhomeSubSys: | 
					
						
							| 
									
										
										
										
											2022-10-27 15:20:01 +08:00
										 |  |  | 		cfg, err := callhome.LookupConfig(s[config.CallhomeSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-10-27 15:20:01 +08:00
										 |  |  | 		// callhome cannot be enabled if license is not registered yet, throw an error.
 | 
					
						
							|  |  |  | 		if cfg.Enabled() && !globalSubnetConfig.Registered() { | 
					
						
							|  |  |  | 			return errors.New("Deployment is not registered with SUBNET. Please register the deployment via 'mc license register ALIAS'") | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 	case config.DriveSubSys: | 
					
						
							|  |  |  | 		if _, err := drive.LookupConfig(s[config.DriveSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 	case config.CacheSubSys: | 
					
						
							|  |  |  | 		if _, err := cache.LookupConfig(s[config.CacheSubSys][config.Default], globalRemoteTargetTransport); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	case config.PolicyOPASubSys: | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 		// In case legacy OPA config is being set, we treat it as if the
 | 
					
						
							|  |  |  | 		// AuthZPlugin is being set.
 | 
					
						
							|  |  |  | 		subSys = config.PolicyPluginSubSys | 
					
						
							|  |  |  | 		fallthrough | 
					
						
							|  |  |  | 	case config.PolicyPluginSubSys: | 
					
						
							| 
									
										
										
										
											2022-12-14 06:28:48 +08:00
										 |  |  | 		if ppargs, err := polplugin.LookupConfig(s, GetDefaultConnSettings(), xhttp.DrainBody); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 		} else if ppargs.URL == nil { | 
					
						
							|  |  |  | 			// Check if legacy opa is configured.
 | 
					
						
							|  |  |  | 			if _, err := opa.LookupConfig(s[config.PolicyOPASubSys][config.Default], | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 				NewHTTPTransport(), xhttp.DrainBody); err != nil { | 
					
						
							| 
									
										
										
										
											2022-05-11 08:14:55 +08:00
										 |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 	case config.BrowserSubSys: | 
					
						
							|  |  |  | 		if _, err := browser.LookupConfig(s[config.BrowserSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	default: | 
					
						
							|  |  |  | 		if config.LoggerSubSystems.Contains(subSys) { | 
					
						
							| 
									
										
										
										
											2023-08-03 17:47:07 +08:00
										 |  |  | 			if err := logger.ValidateSubSysConfig(ctx, s, subSys); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if config.NotifySubSystems.Contains(subSys) { | 
					
						
							| 
									
										
										
										
											2023-05-25 13:57:37 +08:00
										 |  |  | 		if err := notify.TestSubSysNotificationTargets(ctx, s, subSys, NewHTTPTransport()); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if config.LambdaSubSystems.Contains(subSys) { | 
					
						
							|  |  |  | 		if err := lambda.TestSubSysLambdaTargets(GlobalContext, s, subSys, NewHTTPTransport()); err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-25 13:57:37 +08:00
										 |  |  | func validateConfig(ctx context.Context, s config.Config, subSys string) error { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	objAPI := newObjectLayerFn() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// We must have a global lock for this so nobody else modifies env while we do.
 | 
					
						
							|  |  |  | 	defer env.LockSetEnv()() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Disable merging env values with config for validation.
 | 
					
						
							|  |  |  | 	env.SetEnvOff() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Enable env values to validate KMS.
 | 
					
						
							|  |  |  | 	defer env.SetEnvOn() | 
					
						
							|  |  |  | 	if subSys != "" { | 
					
						
							| 
									
										
										
										
											2023-05-25 13:57:37 +08:00
										 |  |  | 		return validateSubSysConfig(ctx, s, subSys, objAPI) | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-11-10 01:27:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	// No sub-system passed. Validate all of them.
 | 
					
						
							|  |  |  | 	for _, ss := range config.SubSystems.ToSlice() { | 
					
						
							| 
									
										
										
										
											2023-05-25 13:57:37 +08:00
										 |  |  | 		if err := validateSubSysConfig(ctx, s, ss, objAPI); err != nil { | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-02 01:52:38 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 02:36:41 +08:00
										 |  |  | 	return nil | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-19 02:22:29 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | func lookupConfigs(s config.Config, objAPI ObjectLayer) { | 
					
						
							| 
									
										
										
										
											2020-04-10 00:30:02 +08:00
										 |  |  | 	ctx := GlobalContext | 
					
						
							| 
									
										
										
										
											2019-12-15 09:27:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 	dnsURL, dnsUser, dnsPass, err := env.LookupEnv(config.EnvDNSWebhook) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize remote webhook DNS config %w", err)) | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if err == nil && dnsURL != "" { | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 		bootstrapTraceMsg("initialize remote bucket DNS store") | 
					
						
							| 
									
										
										
										
											2020-09-11 05:19:32 +08:00
										 |  |  | 		globalDNSConfig, err = dns.NewOperatorDNS(dnsURL, | 
					
						
							|  |  |  | 			dns.Authentication(dnsUser, dnsPass), | 
					
						
							|  |  |  | 			dns.RootCAs(globalRootCAs)) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to initialize remote webhook DNS config %w", err)) | 
					
						
							| 
									
										
										
										
											2020-09-11 05:19:32 +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 { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 		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 { | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 		bootstrapTraceMsg("initialize etcd store") | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 		globalEtcdClient, err = etcd.New(etcdCfg) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 			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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-11 05:19:32 +08:00
										 |  |  | 		if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil { | 
					
						
							|  |  |  | 			if globalDNSConfig != nil { | 
					
						
							|  |  |  | 				// if global DNS is already configured, indicate with a warning, incase
 | 
					
						
							|  |  |  | 				// users are confused.
 | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 				logger.LogIf(ctx, fmt.Errorf("DNS store is already configured with %s, etcd is not used for DNS store", globalDNSConfig)) | 
					
						
							| 
									
										
										
										
											2020-09-11 05:19:32 +08:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config, | 
					
						
							|  |  |  | 					dns.DomainNames(globalDomainNames), | 
					
						
							|  |  |  | 					dns.DomainIPs(globalDomainIPs), | 
					
						
							|  |  |  | 					dns.DomainPort(globalMinioPort), | 
					
						
							|  |  |  | 					dns.CoreDNSPath(etcdCfg.CoreDNSPath), | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 				if err != nil { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 	globalSite, err = config.LookupSite(s[config.SiteSubSys][config.Default], s[config.RegionSubSys][config.Default]) | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 		logger.LogIf(ctx, fmt.Errorf("Invalid site configuration: %w", err)) | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-22 23:45:30 +08:00
										 |  |  | 	globalAutoEncryption = crypto.LookupAutoEncryption() // Enable auto-encryption if enabled
 | 
					
						
							|  |  |  | 	if globalAutoEncryption && GlobalKMS == nil { | 
					
						
							|  |  |  | 		logger.Fatal(errors.New("no KMS configured"), "MINIO_KMS_AUTO_ENCRYPTION requires a valid KMS configuration") | 
					
						
							| 
									
										
										
										
											2020-09-04 03:43:45 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-13 02:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 	transport := NewHTTPTransport() | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 	bootstrapTraceMsg("initialize the event notification targets") | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 	globalNotifyTargetList, err = notify.FetchEnabledTargets(GlobalContext, s, transport) | 
					
						
							| 
									
										
										
										
											2020-03-14 15:01:15 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err)) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 	bootstrapTraceMsg("initialize the lambda targets") | 
					
						
							| 
									
										
										
										
											2023-03-08 00:12:41 +08:00
										 |  |  | 	globalLambdaTargetList, err = lambda.FetchEnabledTargets(GlobalContext, s, transport) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		logger.LogIf(ctx, fmt.Errorf("Unable to initialize lambda target(s): %w", err)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 	bootstrapTraceMsg("applying the dynamic configuration") | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 	// Apply dynamic config values
 | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 	if err := applyDynamicConfig(ctx, objAPI, s); err != nil { | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 		logger.LogIf(ctx, err) | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | func applyDynamicConfigForSubSys(ctx context.Context, objAPI ObjectLayer, s config.Config, subSys string) error { | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 	if objAPI == nil { | 
					
						
							|  |  |  | 		return errServerNotInitialized | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setDriveCounts := objAPI.SetDriveCounts() | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 	switch subSys { | 
					
						
							|  |  |  | 	case config.APISubSys: | 
					
						
							|  |  |  | 		apiConfig, err := api.LookupConfig(s[config.APISubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Invalid api configuration: %w", err)) | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 		globalAPIConfig.init(apiConfig, setDriveCounts) | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Initialize remote instance transport once.
 | 
					
						
							|  |  |  | 		getRemoteInstanceTransportOnce.Do(func() { | 
					
						
							| 
									
										
										
										
											2022-12-13 12:31:21 +08:00
										 |  |  | 			getRemoteInstanceTransport = NewHTTPTransportWithTimeout(apiConfig.RemoteTransportDeadline) | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 		}) | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 	case config.CompressionSubSys: | 
					
						
							|  |  |  | 		cmpCfg, err := compress.LookupConfig(s[config.CompressionSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return fmt.Errorf("Unable to setup Compression: %w", err) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		globalCompressConfigMu.Lock() | 
					
						
							|  |  |  | 		globalCompressConfig = cmpCfg | 
					
						
							|  |  |  | 		globalCompressConfigMu.Unlock() | 
					
						
							|  |  |  | 	case config.HealSubSys: | 
					
						
							|  |  |  | 		healCfg, err := heal.LookupConfig(s[config.HealSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return fmt.Errorf("Unable to apply heal config: %w", err) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		globalHealConfig.Update(healCfg) | 
					
						
							| 
									
										
										
										
											2023-12-02 18:51:33 +08:00
										 |  |  | 	case config.BatchSubSys: | 
					
						
							|  |  |  | 		batchCfg, err := batch.LookupConfig(s[config.BatchSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return fmt.Errorf("Unable to apply batch config: %w", err) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		globalBatchConfig.Update(batchCfg) | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 	case config.ScannerSubSys: | 
					
						
							|  |  |  | 		scannerCfg, err := scanner.LookupConfig(s[config.ScannerSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return fmt.Errorf("Unable to apply scanner config: %w", err) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		// update dynamic scanner values.
 | 
					
						
							| 
									
										
										
										
											2024-01-05 07:07:17 +08:00
										 |  |  | 		scannerIdleMode.Store(scannerCfg.IdleMode) | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 		scannerCycle.Store(scannerCfg.Cycle) | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 		logger.LogIf(ctx, scannerSleeper.Update(scannerCfg.Delay, scannerCfg.MaxWait)) | 
					
						
							|  |  |  | 	case config.LoggerWebhookSubSys: | 
					
						
							| 
									
										
										
										
											2023-08-03 17:47:07 +08:00
										 |  |  | 		loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.LoggerWebhookSubSys) | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load logger webhook config: %w", err)) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		userAgent := getUserAgent(getMinioMode()) | 
					
						
							|  |  |  | 		for n, l := range loggerCfg.HTTP { | 
					
						
							|  |  |  | 			if l.Enabled { | 
					
						
							| 
									
										
										
										
											2022-05-12 22:20:58 +08:00
										 |  |  | 				l.LogOnce = logger.LogOnceConsoleIf | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 				l.UserAgent = userAgent | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 				l.Transport = NewHTTPTransportWithClientCerts(l.ClientCert, l.ClientKey) | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-11-29 00:03:26 +08:00
										 |  |  | 			loggerCfg.HTTP[n] = l | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-05-09 12:20:31 +08:00
										 |  |  | 		if errs := logger.UpdateSystemTargets(ctx, loggerCfg); len(errs) > 0 { | 
					
						
							| 
									
										
										
										
											2022-11-29 00:03:26 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to update logger webhook config: %v", errs)) | 
					
						
							| 
									
										
										
										
											2022-02-18 03:11:15 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 	case config.AuditWebhookSubSys: | 
					
						
							| 
									
										
										
										
											2023-08-03 17:47:07 +08:00
										 |  |  | 		loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.AuditWebhookSubSys) | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load audit webhook config: %w", err)) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		userAgent := getUserAgent(getMinioMode()) | 
					
						
							|  |  |  | 		for n, l := range loggerCfg.AuditWebhook { | 
					
						
							|  |  |  | 			if l.Enabled { | 
					
						
							| 
									
										
										
										
											2022-05-12 22:20:58 +08:00
										 |  |  | 				l.LogOnce = logger.LogOnceConsoleIf | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 				l.UserAgent = userAgent | 
					
						
							| 
									
										
										
										
											2022-10-25 08:44:15 +08:00
										 |  |  | 				l.Transport = NewHTTPTransportWithClientCerts(l.ClientCert, l.ClientKey) | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-11-29 00:03:26 +08:00
										 |  |  | 			loggerCfg.AuditWebhook[n] = l | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-09 12:20:31 +08:00
										 |  |  | 		if errs := logger.UpdateAuditWebhookTargets(ctx, loggerCfg); len(errs) > 0 { | 
					
						
							| 
									
										
										
										
											2022-11-29 00:03:26 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to update audit webhook targets: %v", errs)) | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	case config.AuditKafkaSubSys: | 
					
						
							| 
									
										
										
										
											2023-08-03 17:47:07 +08:00
										 |  |  | 		loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.AuditKafkaSubSys) | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load audit kafka config: %w", err)) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for n, l := range loggerCfg.AuditKafka { | 
					
						
							|  |  |  | 			if l.Enabled { | 
					
						
							| 
									
										
										
										
											2023-06-22 01:50:40 +08:00
										 |  |  | 				if l.TLS.Enable { | 
					
						
							|  |  |  | 					l.TLS.RootCAs = globalRootCAs | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 				l.LogOnce = logger.LogOnceIf | 
					
						
							|  |  |  | 				loggerCfg.AuditKafka[n] = l | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-05-09 12:20:31 +08:00
										 |  |  | 		if errs := logger.UpdateAuditKafkaTargets(ctx, loggerCfg); len(errs) > 0 { | 
					
						
							| 
									
										
										
										
											2022-11-29 00:03:26 +08:00
										 |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to update audit kafka targets: %v", errs)) | 
					
						
							| 
									
										
										
										
											2022-02-25 01:05:33 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-04-22 03:07:33 +08:00
										 |  |  | 	case config.StorageClassSubSys: | 
					
						
							| 
									
										
										
										
											2022-09-27 00:04:54 +08:00
										 |  |  | 		for i, setDriveCount := range setDriveCounts { | 
					
						
							|  |  |  | 			sc, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				logger.LogIf(ctx, fmt.Errorf("Unable to initialize storage class config: %w", err)) | 
					
						
							|  |  |  | 				break | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// if we validated all setDriveCounts and it was successful
 | 
					
						
							|  |  |  | 			// proceed to store the correct storage class globally.
 | 
					
						
							|  |  |  | 			if i == len(setDriveCounts)-1 { | 
					
						
							|  |  |  | 				globalStorageClass.Update(sc) | 
					
						
							| 
									
										
										
										
											2022-04-22 03:07:33 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-10-27 15:20:01 +08:00
										 |  |  | 	case config.SubnetSubSys: | 
					
						
							|  |  |  | 		subnetConfig, err := subnet.LookupConfig(s[config.SubnetSubSys][config.Default], globalProxyTransport) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to parse subnet configuration: %w", err)) | 
					
						
							|  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2023-11-25 01:59:35 +08:00
										 |  |  | 			globalSubnetConfig.Update(subnetConfig, globalIsCICD) | 
					
						
							| 
									
										
										
										
											2022-10-27 15:20:01 +08:00
										 |  |  | 			globalSubnetConfig.ApplyEnv() // update environment settings for Console UI
 | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 	case config.CallhomeSubSys: | 
					
						
							|  |  |  | 		callhomeCfg, err := callhome.LookupConfig(s[config.CallhomeSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load callhome config: %w", err)) | 
					
						
							|  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2022-10-27 15:20:01 +08:00
										 |  |  | 			enable := callhomeCfg.Enable && !globalCallhomeConfig.Enabled() | 
					
						
							|  |  |  | 			globalCallhomeConfig.Update(callhomeCfg) | 
					
						
							|  |  |  | 			if enable { | 
					
						
							|  |  |  | 				initCallhome(ctx, objAPI) | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-06-07 07:14:52 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-11-28 01:15:06 +08:00
										 |  |  | 	case config.DriveSubSys: | 
					
						
							|  |  |  | 		if driveConfig, err := drive.LookupConfig(s[config.DriveSubSys][config.Default]); err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load drive config: %w", err)) | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			err := globalDriveConfig.Update(driveConfig) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				logger.LogIf(ctx, fmt.Errorf("Unable to update drive config: %v", err)) | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-11-23 05:46:17 +08:00
										 |  |  | 	case config.CacheSubSys: | 
					
						
							|  |  |  | 		cacheCfg, err := cache.LookupConfig(s[config.CacheSubSys][config.Default], globalRemoteTargetTransport) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.LogIf(ctx, fmt.Errorf("Unable to load cache config: %w", err)) | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			globalCacheConfig.Update(cacheCfg) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2024-01-02 00:36:33 +08:00
										 |  |  | 	case config.BrowserSubSys: | 
					
						
							|  |  |  | 		browserCfg, err := browser.LookupConfig(s[config.BrowserSubSys][config.Default]) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return fmt.Errorf("Unable to apply browser config: %w", err) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		globalBrowserConfig.Update(browserCfg) | 
					
						
							| 
									
										
										
										
											2022-02-18 03:11:15 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 	globalServerConfigMu.Lock() | 
					
						
							|  |  |  | 	defer globalServerConfigMu.Unlock() | 
					
						
							|  |  |  | 	if globalServerConfig != nil { | 
					
						
							| 
									
										
										
										
											2022-02-23 02:59:28 +08:00
										 |  |  | 		globalServerConfig[subSys] = s[subSys] | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // applyDynamicConfig will apply dynamic config values.
 | 
					
						
							|  |  |  | // Dynamic systems should be in config.SubSystemsDynamic as well.
 | 
					
						
							|  |  |  | func applyDynamicConfig(ctx context.Context, objAPI ObjectLayer, s config.Config) error { | 
					
						
							|  |  |  | 	for subSys := range config.SubSystemsDynamic { | 
					
						
							|  |  |  | 		err := applyDynamicConfigForSubSys(ctx, objAPI, s, subSys) | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							| 
									
										
										
										
											2020-12-05 01:32:35 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return nil | 
					
						
							| 
									
										
										
										
											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 { | 
					
						
							| 
									
										
										
										
											2021-11-26 05:06:25 +08:00
										 |  |  | 		subSysHelp, ok = config.HelpDeprecatedSubSysMap[subSys] | 
					
						
							|  |  |  | 		if !ok { | 
					
						
							|  |  |  | 			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
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-03 21:52:52 +08:00
										 |  |  | 	help := config.HelpKVS{} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// 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 { | 
					
						
							|  |  |  | 		key := madmin.EnableKey | 
					
						
							|  |  |  | 		if envOnly { | 
					
						
							|  |  |  | 			key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(madmin.EnableKey) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		help = append(help, config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         key, | 
					
						
							|  |  |  | 			Description: fmt.Sprintf("enable %s target, default is 'off'", subSys), | 
					
						
							|  |  |  | 			Optional:    false, | 
					
						
							|  |  |  | 			Type:        "on|off", | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for _, hkv := range h { | 
					
						
							|  |  |  | 		key := hkv.Key | 
					
						
							|  |  |  | 		if envOnly { | 
					
						
							|  |  |  | 			key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(hkv.Key) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		help = append(help, config.HelpKV{ | 
					
						
							|  |  |  | 			Key:         key, | 
					
						
							|  |  |  | 			Description: hkv.Description, | 
					
						
							|  |  |  | 			Optional:    hkv.Optional, | 
					
						
							|  |  |  | 			Type:        hkv.Type, | 
					
						
							|  |  |  | 		}) | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return Help{ | 
					
						
							|  |  |  | 		SubSys:          subSys, | 
					
						
							|  |  |  | 		Description:     subSysHelp.Description, | 
					
						
							|  |  |  | 		MultipleTargets: subSysHelp.MultipleTargets, | 
					
						
							| 
									
										
										
										
											2023-02-03 21:52:52 +08:00
										 |  |  | 		KeysHelp:        help, | 
					
						
							| 
									
										
										
										
											2019-11-20 05:48:13 +08:00
										 |  |  | 	}, 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.
 | 
					
						
							| 
									
										
										
										
											2022-08-09 07:16:27 +08:00
										 |  |  | 	return saveServerConfig(GlobalContext, objAPI, srvCfg) | 
					
						
							| 
									
										
										
										
											2017-02-08 04:51:43 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-23 13:59:13 +08:00
										 |  |  | func getValidConfig(objAPI ObjectLayer) (config.Config, error) { | 
					
						
							| 
									
										
										
										
											2022-12-20 03:10:14 +08:00
										 |  |  | 	return readServerConfig(GlobalContext, objAPI, 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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-30 15:04:39 +08:00
										 |  |  | // loadConfig - loads a new config from disk, overrides params
 | 
					
						
							|  |  |  | // from env if found and valid
 | 
					
						
							| 
									
										
										
										
											2022-12-20 03:10:14 +08:00
										 |  |  | // data is optional. If nil it will be loaded from backend.
 | 
					
						
							|  |  |  | func loadConfig(objAPI ObjectLayer, data []byte) error { | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 	bootstrapTraceMsg("load the configuration") | 
					
						
							| 
									
										
										
										
											2022-12-20 03:10:14 +08:00
										 |  |  | 	srvCfg, err := readServerConfig(GlobalContext, objAPI, data) | 
					
						
							| 
									
										
										
										
											2020-12-02 03:59:03 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		return err | 
					
						
							| 
									
										
										
										
											2017-03-17 02:06:17 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-12-07 19:41:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-23 18:07:06 +08:00
										 |  |  | 	bootstrapTraceMsg("lookup the configuration") | 
					
						
							| 
									
										
										
										
											2018-08-15 12:41:47 +08:00
										 |  |  | 	// Override any values from ENVs.
 | 
					
						
							| 
									
										
										
										
											2021-09-02 02:34:07 +08:00
										 |  |  | 	lookupConfigs(srvCfg, objAPI) | 
					
						
							| 
									
										
										
										
											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
										 |  |  | } |