mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-16 09:36:18 +02:00
Get rid of init() in config.go
This commit is contained in:
10
config.go
10
config.go
@@ -231,9 +231,7 @@ var conf = config{
|
|||||||
BufferPoolCalibrationThreshold: 1024,
|
BufferPoolCalibrationThreshold: 1024,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func configure() {
|
||||||
initSyslog()
|
|
||||||
|
|
||||||
keyPath := flag.String("keypath", "", "path of the file with hex-encoded key")
|
keyPath := flag.String("keypath", "", "path of the file with hex-encoded key")
|
||||||
saltPath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
|
saltPath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
|
||||||
presetsPath := flag.String("presets", "", "path of the file with presets")
|
presetsPath := flag.String("presets", "", "path of the file with presets")
|
||||||
@@ -463,10 +461,4 @@ func init() {
|
|||||||
if conf.BufferPoolCalibrationThreshold < 64 {
|
if conf.BufferPoolCalibrationThreshold < 64 {
|
||||||
logFatal("Buffer pool calibration threshold should be greater than or equal to 64")
|
logFatal("Buffer pool calibration threshold should be greater than or equal to 64")
|
||||||
}
|
}
|
||||||
|
|
||||||
initNewrelic()
|
|
||||||
initPrometheus()
|
|
||||||
initDownloading()
|
|
||||||
initErrorsReporting()
|
|
||||||
initVips()
|
|
||||||
}
|
}
|
||||||
|
12
main.go
12
main.go
@@ -16,7 +16,19 @@ const version = "2.2.13"
|
|||||||
|
|
||||||
type ctxKey string
|
type ctxKey string
|
||||||
|
|
||||||
|
func initialize() {
|
||||||
|
initSyslog()
|
||||||
|
configure()
|
||||||
|
initNewrelic()
|
||||||
|
initPrometheus()
|
||||||
|
initDownloading()
|
||||||
|
initErrorsReporting()
|
||||||
|
initVips()
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
initialize()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
var logMemStats = len(os.Getenv("IMGPROXY_LOG_MEM_STATS")) > 0
|
var logMemStats = len(os.Getenv("IMGPROXY_LOG_MEM_STATS")) > 0
|
||||||
|
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -10,6 +13,11 @@ type MainTestSuite struct {
|
|||||||
oldConf config
|
oldConf config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
initialize()
|
||||||
|
os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
func (s *MainTestSuite) SetupTest() {
|
func (s *MainTestSuite) SetupTest() {
|
||||||
s.oldConf = conf
|
s.oldConf = conf
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user