Skip to content

Commit

Permalink
feat!: add PROCESSOR_COUNT env var
Browse files Browse the repository at this point in the history
Some of our services use a PROCESSOR_COUNT env var to help determine how
many processes to run (e.g. bundler, etc). In the old consul-template
version this was a shell call. Use runtime to set this value instead

BREAKING CHANGE: adds PROCESSOR_COUNT which will override any Consul or Vault value
  • Loading branch information
mloberg committed Jan 31, 2023
1 parent 5aaa079 commit 6c9b8e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"errors"
"os"
"os/exec"
"runtime"
"strconv"
"strings"

"github.com/rs/zerolog"
Expand Down Expand Up @@ -59,6 +61,8 @@ func main() {
logger.Warn().Msg("Not loading values from Vault. VAULT_ADDR is not set")
}

env.Add("PROCESSOR_COUNT", strconv.Itoa(runtime.NumCPU()))

exit := run(os.Args[1], os.Args[2:], env.Environ(), logger)
os.Exit(exit)
}
Expand Down

0 comments on commit 6c9b8e4

Please sign in to comment.