mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
feat: improve task runner environment configuration
- Remove Crawlab-specific environment variables from the task runner's environment - Automatically create workspace directory if it doesn't exist - Enhance environment setup to prevent potential configuration conflicts
This commit is contained in:
@@ -390,6 +390,16 @@ func (r *Runner) configureEnv() {
|
||||
|
||||
// Default envs
|
||||
r.cmd.Env = os.Environ()
|
||||
|
||||
// Remove CRAWLAB_ prefixed environment variables
|
||||
for i := 0; i < len(r.cmd.Env); i++ {
|
||||
if strings.HasPrefix(r.cmd.Env[i], "CRAWLAB_") {
|
||||
r.cmd.Env = append(r.cmd.Env[:i], r.cmd.Env[i+1:]...)
|
||||
i--
|
||||
}
|
||||
}
|
||||
|
||||
// Task-specific environment variables
|
||||
r.cmd.Env = append(r.cmd.Env, "CRAWLAB_TASK_ID="+r.tid.Hex())
|
||||
|
||||
// Global environment variables
|
||||
|
||||
Reference in New Issue
Block a user