mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-10 06:01:44 +08:00
Fix attached runtime configuration string ambiguity with IPv6 (#459)
* Fix attached runtime configuration string ambiguity with IPv6 * Preserve the NODE:COOKIE order
This commit is contained in:
parent
6575791bed
commit
756420f5fa
1 changed files with 10 additions and 1 deletions
|
|
@ -200,7 +200,7 @@ defmodule Livebook.Config do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp parse_connection_config!(config) do
|
defp parse_connection_config!(config) do
|
||||||
[node, cookie] = String.split(config, ":", parts: 2)
|
{node, cookie} = split_at_last_occurrence(config, ":")
|
||||||
|
|
||||||
unless node =~ "@" do
|
unless node =~ "@" do
|
||||||
abort!(~s{expected node to include hostname, got: #{inspect(node)}})
|
abort!(~s{expected node to include hostname, got: #{inspect(node)}})
|
||||||
|
|
@ -212,6 +212,15 @@ defmodule Livebook.Config do
|
||||||
{node, cookie}
|
{node, cookie}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp split_at_last_occurrence(string, pattern) do
|
||||||
|
{idx, 1} = string |> :binary.matches(pattern) |> List.last()
|
||||||
|
|
||||||
|
{
|
||||||
|
binary_part(string, 0, idx),
|
||||||
|
binary_part(string, idx + 1, byte_size(string) - idx - 1)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Aborts booting due to a configuration error.
|
Aborts booting due to a configuration error.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue