storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/config/help.go (about) 1 /* 2 * MinIO Cloud Storage, (C) 2019 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package config 18 19 // HelpKV - implements help messages for keys 20 // with value as description of the keys. 21 type HelpKV struct { 22 Key string `json:"key"` 23 Type string `json:"type"` 24 Description string `json:"description"` 25 Optional bool `json:"optional"` 26 27 // Indicates if sub-sys supports multiple targets. 28 MultipleTargets bool `json:"multipleTargets"` 29 } 30 31 // HelpKVS - implement order of keys help messages. 32 type HelpKVS []HelpKV 33 34 // Lookup - lookup a key from help kvs. 35 func (hkvs HelpKVS) Lookup(key string) (HelpKV, bool) { 36 for _, hkv := range hkvs { 37 if hkv.Key == key { 38 return hkv, true 39 } 40 } 41 return HelpKV{}, false 42 } 43 44 // DefaultComment used across all sub-systems. 45 const DefaultComment = "optionally add a comment to this setting" 46 47 // Region and Worm help is documented in default config 48 var ( 49 RegionHelp = HelpKVS{ 50 HelpKV{ 51 Key: RegionName, 52 Type: "string", 53 Description: `name of the location of the server e.g. "us-west-rack2"`, 54 Optional: true, 55 }, 56 HelpKV{ 57 Key: Comment, 58 Type: "sentence", 59 Description: DefaultComment, 60 Optional: true, 61 }, 62 } 63 )