1%% This Source Code Form is subject to the terms of the Mozilla Public 2%% License, v. 2.0. If a copy of the MPL was not distributed with this 3%% file, You can obtain one at https://mozilla.org/MPL/2.0/. 4%% 5%% Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. 6%% 7 8%% Endpoints 9 10{mapping, "cluster_formation.etcd.endpoints", "rabbit.cluster_formation.peer_discovery_etcd.endpoints", [ 11 {datatype, {enum, [none]}} 12]}. 13 14{mapping, "cluster_formation.etcd.endpoints.$index", "rabbit.cluster_formation.peer_discovery_etcd.endpoints", [ 15 {datatype, [string, ip]} 16]}. 17 18{translation, "rabbit.cluster_formation.peer_discovery_etcd.endpoints", 19fun(Conf) -> 20 case cuttlefish:conf_get("cluster_formation.etcd.endpoints", Conf, undefined) of 21 none -> []; 22 _ -> 23 Endpoints = cuttlefish_variable:filter_by_prefix("cluster_formation.etcd.endpoints", Conf), 24 [V || {_, V} <- Endpoints] 25 end 26end}. 27 28%% Legacy: etcd host 29 30{mapping, "cluster_formation.etcd.host", "rabbit.cluster_formation.peer_discovery_etcd.etcd_host", [ 31 {datatype, string} 32]}. 33 34{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_host", 35fun(Conf) -> 36 case cuttlefish:conf_get("cluster_formation.etcd.host", Conf, undefined) of 37 undefined -> cuttlefish:unset(); 38 Value -> Value 39 end 40end}. 41 42%% Legacy: etcd port 43 44{mapping, "cluster_formation.etcd.port", "rabbit.cluster_formation.peer_discovery_etcd.etcd_port", [ 45 {datatype, integer}, 46 {validators, ["non_negative_integer"]} 47]}. 48 49{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_port", 50fun(Conf) -> 51 case cuttlefish:conf_get("cluster_formation.etcd.port", Conf, undefined) of 52 undefined -> cuttlefish:unset(); 53 Value -> Value 54 end 55end}. 56 57%% Legacy: etcd scheme. The key remains for backwards compatibility, it will not be used. 58 59{mapping, "cluster_formation.etcd.scheme", "rabbit.cluster_formation.peer_discovery_etcd.etcd_scheme", [ 60 {datatype, string} 61]}. 62 63{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_scheme", 64fun(Conf) -> 65 case cuttlefish:conf_get("cluster_formation.etcd.scheme", Conf, undefined) of 66 undefined -> cuttlefish:unset(); 67 Value -> Value 68 end 69end}. 70 71%% key prefix appended after /rabbitmq/{discovery,locks} (a mandatory prefix we enforce as of #22) 72 73{mapping, "cluster_formation.etcd.key_prefix", "rabbit.cluster_formation.peer_discovery_etcd.etcd_prefix", [ 74 {datatype, string} 75]}. 76 77{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_prefix", 78fun(Conf) -> 79 case cuttlefish:conf_get("cluster_formation.etcd.key_prefix", Conf, undefined) of 80 undefined -> cuttlefish:unset(); 81 Value -> Value 82 end 83end}. 84 85%% cluster name 86 87{mapping, "cluster_formation.etcd.cluster_name", "rabbit.cluster_formation.peer_discovery_etcd.cluster_name", [ 88 {datatype, string} 89]}. 90 91{translation, "rabbit.cluster_formation.peer_discovery_etcd.cluster_name", 92fun(Conf) -> 93 case cuttlefish:conf_get("cluster_formation.etcd.cluster_name", Conf, undefined) of 94 undefined -> cuttlefish:unset(); 95 Value -> Value 96 end 97end}. 98 99%% node key ttl 100 101{mapping, "cluster_formation.etcd.node_ttl", "rabbit.cluster_formation.peer_discovery_etcd.etcd_node_ttl", [ 102 {datatype, integer}, 103 {validators, ["non_negative_integer"]} 104]}. 105 106{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_node_ttl", 107fun(Conf) -> 108 case cuttlefish:conf_get("cluster_formation.etcd.node_ttl", Conf, undefined) of 109 undefined -> cuttlefish:unset(); 110 Value -> Value 111 end 112end}. 113 114%% lock acquisition timeout 115 116{mapping, "cluster_formation.etcd.lock_wait_time", "rabbit.cluster_formation.peer_discovery_etcd.lock_wait_time", [ 117 {datatype, integer}, 118 {validators, ["non_negative_integer"]} 119]}. 120 121{mapping, "cluster_formation.etcd.lock_timeout", "rabbit.cluster_formation.peer_discovery_etcd.lock_wait_time", [ 122 {datatype, integer}, 123 {validators, ["non_negative_integer"]} 124]}. 125 126%% an alias for lock acquisition timeout to be consistent with the etcd backend 127 128{translation, "rabbit.cluster_formation.peer_discovery_etcd.lock_wait_time", 129fun(Conf) -> 130 case cuttlefish:conf_get("cluster_formation.etcd.lock_timeout", Conf, undefined) of 131 undefined -> 132 case cuttlefish:conf_get("cluster_formation.etcd.lock_wait_time", Conf, undefined) of 133 undefined -> cuttlefish:unset(); 134 Value -> Value 135 end; 136 Value -> Value 137 end 138end}. 139 140%% authentication 141 142{mapping, "cluster_formation.etcd.username", "rabbit.cluster_formation.peer_discovery_etcd.etcd_username", [ 143 {datatype, string} 144]}. 145 146{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_username", 147fun(Conf) -> 148 case cuttlefish:conf_get("cluster_formation.etcd.username", Conf, undefined) of 149 undefined -> cuttlefish:unset(); 150 Value -> Value 151 end 152end}. 153 154{mapping, "cluster_formation.etcd.password", "rabbit.cluster_formation.peer_discovery_etcd.etcd_password", [ 155 {datatype, string} 156]}. 157 158{translation, "rabbit.cluster_formation.peer_discovery_etcd.etcd_password", 159fun(Conf) -> 160 case cuttlefish:conf_get("cluster_formation.etcd.password", Conf, undefined) of 161 undefined -> cuttlefish:unset(); 162 Value -> Value 163 end 164end}. 165 166%% 167%% TLS client options 168%% 169 170{mapping, "cluster_formation.etcd.ssl_options", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options", [ 171 {datatype, {enum, [none]}} 172]}. 173 174{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options", 175fun(Conf) -> 176 case cuttlefish:conf_get("cluster_formation.etcd.ssl_options", Conf, undefined) of 177 none -> []; 178 _ -> cuttlefish:invalid("Invalid cluster_formation.etcd.ssl_options") 179 end 180end}. 181 182{mapping, "cluster_formation.etcd.ssl_options.verify", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.verify", [ 183 {datatype, {enum, [verify_peer, verify_none]}}]}. 184 185{mapping, "cluster_formation.etcd.ssl_options.fail_if_no_peer_cert", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.fail_if_no_peer_cert", [ 186 {datatype, {enum, [true, false]}}]}. 187 188{mapping, "cluster_formation.etcd.ssl_options.cacertfile", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.cacertfile", 189 [{datatype, string}, {validators, ["file_accessible"]}]}. 190 191{mapping, "cluster_formation.etcd.ssl_options.certfile", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.certfile", 192 [{datatype, string}, {validators, ["file_accessible"]}]}. 193 194{mapping, "cluster_formation.etcd.ssl_options.cacerts.$name", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.cacerts", 195 [{datatype, string}]}. 196 197{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.cacerts", 198fun(Conf) -> 199 Settings = cuttlefish_variable:filter_by_prefix("cluster_formation.etcd.ssl_options.cacerts", Conf), 200 [ list_to_binary(V) || {_, V} <- Settings ] 201end}. 202 203{mapping, "cluster_formation.etcd.ssl_options.cert", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.cert", 204 [{datatype, string}]}. 205 206{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.cert", 207fun(Conf) -> 208 list_to_binary(cuttlefish:conf_get("cluster_formation.etcd.ssl_options.cert", Conf)) 209end}. 210 211{mapping, "cluster_formation.etcd.ssl_options.crl_check", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.crl_check", 212 [{datatype, [{enum, [true, false, peer, best_effort]}]}]}. 213 214{mapping, "cluster_formation.etcd.ssl_options.depth", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.depth", 215 [{datatype, integer}, {validators, ["byte"]}]}. 216 217{mapping, "cluster_formation.etcd.ssl_options.dh", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.dh", 218 [{datatype, string}]}. 219 220{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.dh", 221fun(Conf) -> 222 list_to_binary(cuttlefish:conf_get("cluster_formation.etcd.ssl_options.dh", Conf)) 223end}. 224 225{mapping, "cluster_formation.etcd.ssl_options.dhfile", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.dhfile", 226 [{datatype, string}, {validators, ["file_accessible"]}]}. 227 228{mapping, "cluster_formation.etcd.ssl_options.key.RSAPrivateKey", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.key", 229 [{datatype, string}]}. 230 231{mapping, "cluster_formation.etcd.ssl_options.key.DSAPrivateKey", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.key", 232 [{datatype, string}]}. 233 234{mapping, "cluster_formation.etcd.ssl_options.key.PrivateKeyInfo", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.key", 235 [{datatype, string}]}. 236 237{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.key", 238fun(Conf) -> 239 case cuttlefish_variable:filter_by_prefix("cluster_formation.etcd.ssl_options.key", Conf) of 240 [{[_,_,Key], Val}|_] -> {list_to_atom(Key), list_to_binary(Val)}; 241 _ -> undefined 242 end 243end}. 244 245{mapping, "cluster_formation.etcd.ssl_options.keyfile", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.keyfile", 246 [{datatype, string}, {validators, ["file_accessible"]}]}. 247 248{mapping, "cluster_formation.etcd.ssl_options.log_alert", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.log_alert", 249 [{datatype, {enum, [true, false]}}]}. 250 251{mapping, "cluster_formation.etcd.ssl_options.password", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.password", 252 [{datatype, string}]}. 253 254{mapping, "cluster_formation.etcd.ssl_options.psk_identity", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.psk_identity", 255 [{datatype, string}]}. 256 257{mapping, "cluster_formation.etcd.ssl_options.reuse_sessions", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.reuse_sessions", 258 [{datatype, {enum, [true, false]}}]}. 259 260{mapping, "cluster_formation.etcd.ssl_options.secure_renegotiate", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.secure_renegotiate", 261 [{datatype, {enum, [true, false]}}]}. 262 263{mapping, "cluster_formation.etcd.ssl_options.versions.$version", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.versions", 264 [{datatype, atom}]}. 265 266{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.versions", 267fun(Conf) -> 268 Settings = cuttlefish_variable:filter_by_prefix("cluster_formation.etcd.ssl_options.versions", Conf), 269 [V || {_, V} <- Settings] 270end}. 271 272{mapping, "cluster_formation.etcd.ssl_options.ciphers.$cipher", "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.ciphers", 273 [{datatype, string}]}. 274 275{translation, "rabbit.cluster_formation.peer_discovery_etcd.ssl_options.ciphers", 276fun(Conf) -> 277 Settings = cuttlefish_variable:filter_by_prefix("cluster_formation.etcd.ssl_options.ciphers", Conf), 278 lists:reverse([V || {_, V} <- Settings]) 279end}. 280