mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 12:46:03 +01:00
40 lines
834 B
Go
40 lines
834 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
|
|
"github.com/vmware/harbor/utils/log"
|
|
)
|
|
|
|
const defaultMaxWorkers int = 10
|
|
|
|
var maxJobWorkers int
|
|
var localRegURL string
|
|
|
|
func init() {
|
|
maxWorkersEnv := os.Getenv("MAX_JOB_WORKERS")
|
|
maxWorkers64, err := strconv.ParseInt(maxWorkersEnv, 10, 32)
|
|
maxJobWorkers = int(maxWorkers64)
|
|
if err != nil {
|
|
log.Warningf("Failed to parse max works setting, error: %v, the default value: %d will be used", err, defaultMaxWorkers)
|
|
maxJobWorkers = defaultMaxWorkers
|
|
}
|
|
|
|
localRegURL = os.Getenv("LOCAL_REGISTRY_URL")
|
|
if len(localRegURL) == 0 {
|
|
localRegURL = "http://registry:5000/"
|
|
}
|
|
|
|
log.Debugf("config: maxJobWorkers: %d", maxJobWorkers)
|
|
log.Debugf("config: localRegURL: %s", localRegURL)
|
|
}
|
|
|
|
func MaxJobWorkers() int {
|
|
return maxJobWorkers
|
|
}
|
|
|
|
func LocalRegURL() string {
|
|
return localRegURL
|
|
}
|