<div dir="ltr">Hello Daniel,<div><br></div><div>Apologies for the delay in response. Thanks for responding to my question!</div><div><br></div><div>I'll try to see if I can get to work with the proxy workaround that you've suggested for now.</div><div><br></div><div>But I do think that it would be nice to enable the distribution in the required mode programmatically.</div><div>I'll see if I can put out a patch.</div><div><br></div><div>Best regards,</div><div>Ajit<br><br><div class="gmail_quote"><div dir="ltr">On Sun, Dec 9, 2018 at 3:33 PM Dániel Szoboszlay <<a href="mailto:dszoboszlay@gmail.com">dszoboszlay@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I don't know about a way to change the distribution module programmatically. You can however list multiple modules, as long as their <font face="monospace">select/1</font> callback can properly sort out which module to use towards which node (may work in IPv4 vs IPv6 cases, wont work with plain vs tls connections).<div><br></div><div>An easy workaround may be to implement your custom distribution module, a proxy, that takes from some app env setting  or similar the name of a real distribution module. Than you can simply proxy all API calls towards that module.</div><div><br></div><div>BR,</div><div>Daniel<br><br><div class="gmail_quote"><div dir="ltr">On Sat, 8 Dec 2018, 08:34 Ajit Yagaty, <<a href="mailto:ajityagaty@gmail.com" target="_blank">ajityagaty@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello All,<div><br></div><div>





<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Currently, one can start an Erlang node in distributed mode by passing in the “proto_dist” parameter on the command line. Could anyone please let me know if there is a way to start the distribution on a non-distributed Erlang node (in any one of inet_tcp/inet6_tcp/inet_tls/inet6_tls modes) programmatically?</p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">In the code (<a href="https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487" target="_blank"><span class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-s1" style="color:rgb(228,175,10)">https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487</span></a>), there seems to be a reliance on the presence of the command line argument “proto_dist”. If not passed, proto_dist always defaults to inet_tcp.</p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">If there is a way to start the distribution programmatically, then the logic that decides what proto_dist value to pass can be moved from the init script (when the application is run as a service) into an Erlang module. This would also help in not having to re-write this code snippet for all the different platforms (Linux/Windows/OSX) that one would want to support.</p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69);min-height:14px"><br></p>
<p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Any tips on this will be very helpful.</p><p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br></p><p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">But if there is no support to start the distribution programmatically, then would it make sense to add that support?</p><p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br></p><p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Best regards,</p><p class="gmail-m_484025474610457453m_-610346273632317944m_-650959888031191593gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Ajit</p></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</div></div>
</blockquote></div></div></div>