* Custom listen
This commit is contained in:
parent
498aba835f
commit
21f24899a2
|
@ -12,6 +12,7 @@ type DHConfig struct {
|
|||
DiskFetchFrequency int `json:"diskFetchFrequency"`
|
||||
MemoryDumpFrequency int `json:"memoryDumpFrequency"`
|
||||
MaxHistoryAge int `json:"maxHistoryAge"`
|
||||
Listen string
|
||||
}
|
||||
|
||||
func GetConfiguration() DHConfig {
|
||||
|
@ -24,6 +25,8 @@ func GetConfiguration() DHConfig {
|
|||
DiskFetchFrequency: 5, // default value
|
||||
MemoryDumpFrequency: 60, // default value
|
||||
MaxHistoryAge: 2592000, // default value
|
||||
|
||||
Listen: ":8080",
|
||||
}
|
||||
|
||||
if val, exists := os.LookupEnv("DISK_FETCH_FREQUENCY"); exists {
|
||||
|
@ -44,5 +47,9 @@ func GetConfiguration() DHConfig {
|
|||
}
|
||||
}
|
||||
|
||||
if val, exists := os.LookupEnv("LISTEN"); exists {
|
||||
config.Listen = val
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
|
3
main.go
3
main.go
|
@ -9,6 +9,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
||||
"tea.chunkbyte.com/kato/drive-health/lib/svc"
|
||||
"tea.chunkbyte.com/kato/drive-health/lib/web"
|
||||
)
|
||||
|
@ -20,7 +21,7 @@ func main() {
|
|||
router := web.SetupRouter()
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: ":8080",
|
||||
Addr: config.GetConfiguration().Listen,
|
||||
Handler: router,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue