Skip to content

Commit

Permalink
add new pkg global
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Nov 26, 2024
1 parent 1845018 commit a864c49
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
10 changes: 2 additions & 8 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ import (
)

var (
TLS_VERIFY = os.Getenv("TLS_VERIFY") == "true"
DEBUG = os.Getenv("DEBUG") == "true"
OS_MAX_THREADS = func() int {
if value, err := strconv.Atoi(os.Getenv("OS_MAX_THREADS")); err == nil && value != 0 {
return value
}
return 10000
}()
TLS_VERIFY = os.Getenv("TLS_VERIFY") == "true"
DEBUG = os.Getenv("DEBUG") == "true"
)

// ExpandWithEnv updates string variables to their corresponding environment values.
Expand Down
21 changes: 21 additions & 0 deletions global/global.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package global

import (
"os"
"strconv"

"github.com/projectdiscovery/utils/sysutil"
)

var OS_MAX_THREADS int

func init() {
OS_MAX_THREADS = func() int {
if value, err := strconv.Atoi(os.Getenv("OS_MAX_THREADS")); err == nil && value != 0 {
return value
}
return 10000
}()

_ = sysutil.SetMaxThreads(OS_MAX_THREADS)
}

0 comments on commit a864c49

Please sign in to comment.