Skip to content

new config changes

Krishna Srinivas edited this page Feb 7, 2019 · 11 revisions

Command line syntax:

mc admin config set|get|delete SUBSYS[:NAME] key1=value1 key2=value2

Example:

mc admin config set worm state=enabled
mc admin config set region name=us-east-1
mc admin config set credential accesskey=minio secretkey=minio123
mc admin config set cache drives=/mnt/disk1,/mnt/disk2,/mnt/disk3 expiry=90

set just updates any previous setting

mc admin config set cache expiry=90
mc admin config set notify.redis:redis1 format=namespace address=1.1.1.1 password=test123
mc admin config set notify.redis:redis1 password=newpasswd # Just update the password
mc admin config set notify.redis:redis1 state=disabled # Just update the state 
mc admin config delete notify.redis:redis1


mc admin config set notify.redis format=namespace address=1.1.1.1 password=test123
mc admin config set notify.redis password=newpasswd # Just update the password
mc admin config set notify.redis state=disabled # Just update the state 
mc admin config delete notify.redis

$ mc admin config get region
set region name=us-east-1 <--- set looks a bit weird here, maybe we should display just "name=us-east-1"

$ mc admin config get
set worm state=enabled
set region name=us-east-1
set credential accesskey=minio secretkey=minio123
set cache drives=/mnt/disk1,/mnt/disk2,/mnt/disk3 expiry=90 state=disabled
set notify.redis:redis1 format=namespace address=1.1.1.1 password=test123
set notify.redis format=namespace address=1.1.1.1 password=test123

$ mc admin config get notify.redis
set notify.redis format=namespace address=1.1.1.1 password=test123

Backend JSON:

{
  "SUBSYS": {
    "default": [
      {"key":"key1", "value":"value1"},
      {"key":"key2", "value":"value2"}
    ],
    "NAME": [
      {"key":"key1", "value":"value1"},
      {"key":"key2", "value":"value2"}
    ]
  }
}

Sample JSON:

{
  "worm": {
    "default": [
      {"key":"state", "value":"enabled"}
    ]
  },
  "region": {
    "default": [
      {"key":"name", "value":"us-east-1"}
    ]
  },
  "credential": {
    "default": [
      {"key":"acceskey", "value":"minio"},
      {"key":"secretkey", "value":"minio123"},
    ]
  },
  "notify.redis": {
    "default": [
      {"key":"endpoint", "value":"http://localhost:9001"},
      {"key":"password", "value":"somepassword1"},
    ]
    "redis1": [
      {"key":"endpoint", "value":"http://localhost:9002"},
      {"key":"password", "value":"somepassword2"},
      {"key":"state", "value":"disabled"},
    ]
  }
}

Go config struct:

type KV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type subsysConfig map[string][]KV

type serverConfig map[string]subsysConfig
Clone this wiki locally