Allow capital letters to match valid service name, such as in MyApp

This commit is contained in:
Tim Tilberg
2024-04-15 09:09:58 -05:00
parent 31669d4dce
commit 69f90387a8
2 changed files with 2 additions and 1 deletions

View File

@@ -301,7 +301,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, hyphens, and underscores" 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_-]+$/i
true true
end end

View File

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