From d3bf643f771ded390948ee72702c89fb6e2e69b4 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:38:57 +0100 Subject: [PATCH] save regexp groups in G1, G2 env variables instead of 1, 2 (#642) --- internal/core/core_test.go | 2 +- internal/core/path.go | 2 +- rtsp-simple-server.yml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/core/core_test.go b/internal/core/core_test.go index 8f3b6d83..482fcf06 100644 --- a/internal/core/core_test.go +++ b/internal/core/core_test.go @@ -214,7 +214,7 @@ import ( ) func main() { - if os.Getenv("1") != "on" { + if os.Getenv("G1") != "on" { panic("environment not set") } diff --git a/internal/core/path.go b/internal/core/path.go index 66b133bf..74728eba 100644 --- a/internal/core/path.go +++ b/internal/core/path.go @@ -526,7 +526,7 @@ func (pa *path) externalCmdEnv() externalcmd.Environment { if len(pa.matches) > 1 { for i, ma := range pa.matches[1:] { - env[strconv.FormatInt(int64(i+1), 10)] = ma + env["G"+strconv.FormatInt(int64(i+1), 10)] = ma } } diff --git a/rtsp-simple-server.yml b/rtsp-simple-server.yml index 45d75794..52abc071 100644 --- a/rtsp-simple-server.yml +++ b/rtsp-simple-server.yml @@ -211,7 +211,7 @@ paths: # The following environment variables are available: # * RTSP_PATH: path name # * RTSP_PORT: server port - # * 1, 2, ...: regular expression groups, if path name is + # * G1, G2, ...: regular expression groups, if path name is # a regular expression. runOnInit: # Restart the command if it exits suddenly. @@ -223,7 +223,7 @@ paths: # The following environment variables are available: # * RTSP_PATH: path name # * RTSP_PORT: server port - # * 1, 2, ...: regular expression groups, if path name is + # * G1, G2, ...: regular expression groups, if path name is # a regular expression. runOnDemand: # Restart the command if it exits suddenly. @@ -241,7 +241,7 @@ paths: # The following environment variables are available: # * RTSP_PATH: path name # * RTSP_PORT: server port - # * 1, 2, ...: regular expression groups, if path name is + # * G1, G2, ...: regular expression groups, if path name is # a regular expression. runOnReady: # Restart the command if it exits suddenly. @@ -252,7 +252,7 @@ paths: # The following environment variables are available: # * RTSP_PATH: path name # * RTSP_PORT: server port - # * 1, 2, ...: regular expression groups, if path name is + # * G1, G2, ...: regular expression groups, if path name is # a regular expression. runOnRead: # Restart the command if it exits suddenly.