Skip to content

Commit

Permalink
feat(runner): support env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jan 7, 2024
1 parent 8263693 commit 7d99fd2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions services/runners/JobPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,24 @@ func (p *JobPool) tryRegisterRunner() bool {
return true
}

if os.Getenv("SEMAPHORE_RUNNER_ID") != "" {

runnerId, err := strconv.Atoi(os.Getenv("SEMAPHORE_RUNNER_ID"))

if err != nil {
panic(err)
}

if os.Getenv("SEMAPHORE_RUNNER_TOKEN") == "" {
panic(fmt.Errorf("runner token required"))
}

p.config = &RunnerConfig{
RunnerID: runnerId,
Token: os.Getenv("SEMAPHORE_RUNNER_TOKEN"),
}
}

log.Info("Trying to register on server")

_, err := os.Stat(util.Config.Runner.ConfigFile)
Expand Down

0 comments on commit 7d99fd2

Please sign in to comment.