private static void PatchErlangInterface()

in installer/CustomAction/CouchIniAction.cs [92:116]


        private static void PatchErlangInterface(Session session, string file)
        {
            byte[] VMBuffer = File.ReadAllBytes(file);

            //Patching erlang interface
            string pattern = @"-kernel inet_dist_use_interface";
            string input = Encoding.UTF8.GetString(VMBuffer);
            Match m = Regex.Match(input, pattern, RegexOptions.IgnoreCase);
            if (!m.Success)
            {
                session.Log("Pattern \"inet_dist_use_interface\" not found, appending fix.");

                using (StreamWriter sw = File.AppendText(file))
                {
                    sw.WriteLine();
                    sw.WriteLine("# Which interfaces should the node listen on?");
                    sw.WriteLine("-kernel inet_dist_use_interface {127,0,0,1}");
                    sw.Close();
                }
            }
            else
            {
                session.Log("Pattern \"inet_dist_use_interface\" found, skipping.");
            }
        }