diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2022-04-05 23:29:47 -0400 |
---|---|---|
committer | Nick Vatamaniuc <vatamane@apache.org> | 2022-04-05 23:31:38 -0400 |
commit | 39a7438518e703cd1ee82b850a6ceda3f448d295 (patch) | |
tree | c75bac1da8c59284be5dd6d13824e0573df615c0 | |
parent | 63ee1944a94c274fb80d29a666229b50c02a2b0a (diff) | |
download | couchdb-39a7438518e703cd1ee82b850a6ceda3f448d295.tar.gz |
Fix undefined cookie in weatherreport_node
If the cookie is undefined then we should not set it so it can pick up
the ~/.erlang.cookie if it is there.
-rw-r--r-- | src/weatherreport/src/weatherreport_node.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/weatherreport/src/weatherreport_node.erl b/src/weatherreport/src/weatherreport_node.erl index a745a0430..aaae80bf8 100644 --- a/src/weatherreport/src/weatherreport_node.erl +++ b/src/weatherreport/src/weatherreport_node.erl @@ -197,7 +197,13 @@ start_net() -> {Type, NodeName} = weatherreport_config:node_name(), ThisNode = append_node_suffix(NodeName, "_diag"), {ok, _} = net_kernel:start([ThisNode, Type]), - erlang:set_cookie(node(), weatherreport_config:cookie()). + case weatherreport_config:cookie() of + undefined -> + % Don't set cookie to undefined so we can pick up the ~/.erlang.cookie + ok; + Cookie when is_atom(Cookie) -> + erlang:set_cookie(node(), Cookie) + end. append_node_suffix(Name, Suffix) -> case string:tokens(Name, "@") of |