summaryrefslogtreecommitdiff
path: root/plugins/server/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-09 02:31:33 +0300
committerValery Piashchynski <[email protected]>2021-06-09 02:31:33 +0300
commit6103228ee951c7c8bf5d425471b7c440980c6044 (patch)
tree698c28d3af1814f49958455a6c518ed62032830f /plugins/server/plugin.go
parent4f3e16892479db4bd8280a46987f3105e46e5c96 (diff)
- Update CI (add new tests)
- Add path scan with regex (find .php/.ph/.sh scripts). When found, try to stat path for potential fix for the [file not exists problem] Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/server/plugin.go')
-rw-r--r--plugins/server/plugin.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 7f694f3c..00639f43 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -24,10 +24,11 @@ import (
// PluginName for the server
const PluginName = "server"
-// RR_RELAY env variable key (internal)
-const RR_RELAY = "RR_RELAY" //nolint:stylecheck
-// RR_RPC env variable key (internal) if the RPC presents
-const RR_RPC = "RR_RPC" //nolint:stylecheck
+// RrRelay env variable key (internal)
+const RrRelay = "RR_RELAY"
+
+// RrRPC env variable key (internal) if the RPC presents
+const RrRPC = "RR_RPC"
// Plugin manages worker
type Plugin struct {
@@ -93,6 +94,12 @@ func (server *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error) {
return nil, errors.E(op, errors.Str("minimum command should be `<executable> <script>"))
}
+ // try to find a path here
+ err := server.scanCommand(cmdArgs)
+ if err != nil {
+ server.log.Info("scan command", "error", err)
+ }
+
return func() *exec.Cmd {
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) //nolint:gosec
utils.IsolateProcess(cmd)
@@ -183,13 +190,13 @@ func (server *Plugin) initFactory() (transport.Factory, error) {
}
func (server *Plugin) setEnv(e Env) []string {
- env := append(os.Environ(), fmt.Sprintf(RR_RELAY+"=%s", server.cfg.Server.Relay))
+ env := append(os.Environ(), fmt.Sprintf(RrRelay+"=%s", server.cfg.Server.Relay))
for k, v := range e {
env = append(env, fmt.Sprintf("%s=%s", strings.ToUpper(k), v))
}
if server.cfg.RPC != nil && server.cfg.RPC.Listen != "" {
- env = append(env, fmt.Sprintf("%s=%s", RR_RPC, server.cfg.RPC.Listen))
+ env = append(env, fmt.Sprintf("%s=%s", RrRPC, server.cfg.RPC.Listen))
}
// set env variables from the config