Add hyphen to the allowed character list for service name

This commit is contained in:
Nick Hammond
2024-03-04 10:03:22 -07:00
parent a02af74dda
commit 3b16e047c5
2 changed files with 2 additions and 2 deletions

View File

@@ -284,7 +284,7 @@ class Kamal::Configuration
end end
def ensure_valid_service_name def ensure_valid_service_name
raise ArgumentError, "Service name can only include alphanumeric characters and hyphens" unless raw_config[:service] =~ /^[a-z0-9-]+$/ raise ArgumentError, "Service name can only include alphanumeric characters, hyphens, and underscores" unless raw_config[:service] =~ /^[a-z0-9-_]+$/
true true
end end

View File

@@ -43,7 +43,7 @@ class ConfigurationTest < ActiveSupport::TestCase
end end
test "service name valid" do test "service name valid" do
assert Kamal::Configuration.new(@deploy.tap { _1[:service] = "hey-app1" }).valid? assert Kamal::Configuration.new(@deploy.tap { _1[:service] = "hey-app1_primary" }).valid?
end end
test "service name invalid" do test "service name invalid" do