mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-22 13:53:23 +08:00
Validate agent name and set default (#2483)
This commit is contained in:
parent
efc17fb01f
commit
17634f9be7
2 changed files with 10 additions and 2 deletions
|
@ -25,7 +25,7 @@ config :mime, :types, %{
|
|||
|
||||
config :livebook,
|
||||
teams_url: "https://teams.livebook.dev",
|
||||
agent_name: nil,
|
||||
agent_name: "livebook-agent",
|
||||
app_service_name: nil,
|
||||
app_service_url: nil,
|
||||
authentication_mode: :token,
|
||||
|
|
|
@ -594,7 +594,15 @@ defmodule Livebook.Config do
|
|||
Parses agent name from env.
|
||||
"""
|
||||
def agent_name!(env) do
|
||||
System.get_env(env)
|
||||
if agent_name = System.get_env(env) do
|
||||
unless agent_name =~ ~r/^[a-z0-9_\-]+$/ do
|
||||
abort!(
|
||||
"expected #{env} to consist of lowercase alphanumeric characters, dashes and underscores, got: #{agent_name}"
|
||||
)
|
||||
end
|
||||
|
||||
agent_name
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
|
Loading…
Reference in a new issue