mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-10 06:54:28 +08:00
Escape quotes in generated dockerfile env vars
This commit is contained in:
parent
e6676cca58
commit
ab182ffecb
2 changed files with 7 additions and 3 deletions
|
@ -247,7 +247,9 @@ defmodule Livebook.Hubs.Dockerfile do
|
||||||
defp format_envs([]), do: nil
|
defp format_envs([]), do: nil
|
||||||
|
|
||||||
defp format_envs(list) do
|
defp format_envs(list) do
|
||||||
Enum.map_join(list, fn {key, value} -> ~s/ENV #{key} "#{value}"\n/ end)
|
Enum.map_join(list, fn {key, value} ->
|
||||||
|
~s/ENV #{key} "#{String.replace(value, ~S["], ~S[\"])}"\n/
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp encrypt_secrets_to_dockerfile(secrets, hub) do
|
defp encrypt_secrets_to_dockerfile(secrets, hub) do
|
||||||
|
|
|
@ -210,7 +210,8 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
dockerfile_config()
|
dockerfile_config()
|
||||||
| environment_variables: [
|
| environment_variables: [
|
||||||
{"LIVEBOOK_IDENTITY_PROVIDER", "cloudflare:foobar"},
|
{"LIVEBOOK_IDENTITY_PROVIDER", "cloudflare:foobar"},
|
||||||
{"LIVEBOOK_TEAMS_URL", "http://localhost:8000"}
|
{"LIVEBOOK_TEAMS_URL", "http://localhost:8000"},
|
||||||
|
{"MY_JSON", ~S|{"foo": "bar"}|}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +223,8 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
assert dockerfile =~ """
|
assert dockerfile =~ """
|
||||||
# Deployment group environment variables
|
# Deployment group environment variables
|
||||||
ENV LIVEBOOK_IDENTITY_PROVIDER "cloudflare:foobar"
|
ENV LIVEBOOK_IDENTITY_PROVIDER "cloudflare:foobar"
|
||||||
ENV LIVEBOOK_TEAMS_URL "http://localhost:8000"\
|
ENV LIVEBOOK_TEAMS_URL "http://localhost:8000"
|
||||||
|
ENV MY_JSON "{\\"foo\\": \\"bar\\"}"\
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue