From 3538baa59c578797f4b2de449ee1bd68ce7ccc17 Mon Sep 17 00:00:00 2001 From: Amarin Phaosawasdi Date: Wed, 4 May 2022 13:03:02 -0700 Subject: [PATCH] fix: relax service name requirements to allow starting with numbers --- src/index.ts | 2 +- test/test-init-config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c85e6562..b69ea0dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,7 @@ import {Profiler} from './profiler'; // eslint-disable-next-line @typescript-eslint/no-var-requires const pjson = require('../../package.json'); -const serviceRegex = /^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$/; +const serviceRegex = /^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$/; function hasService( config: Config diff --git a/test/test-init-config.ts b/test/test-init-config.ts index b83eb74d..393347a3 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -257,7 +257,7 @@ describe('createProfiler', () => { } catch (e) { assert.strictEqual( e.message, - 'Service serviceName does not match regular expression "/^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$/"' + 'Service serviceName does not match regular expression "/^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$/"' ); } });