Started moving to a sqlite3 implementation

This commit is contained in:
2024-01-20 18:35:50 +02:00
parent c4aef27eda
commit c0f1ed6879
14 changed files with 195 additions and 331 deletions

View File

@@ -9,10 +9,10 @@ import (
)
type DHConfig struct {
DiskFetchFrequency int `json:"diskFetchFrequency"`
MemoryDumpFrequency int `json:"memoryDumpFrequency"`
MaxHistoryAge int `json:"maxHistoryAge"`
Listen string
DiskFetchFrequency int `json:"diskFetchFrequency"`
MaxHistoryAge int `json:"maxHistoryAge"`
DatabaseFilePath string
Listen string
}
func GetConfiguration() DHConfig {
@@ -22,9 +22,9 @@ func GetConfiguration() DHConfig {
}
config := DHConfig{
DiskFetchFrequency: 5, // default value
MemoryDumpFrequency: 60, // default value
MaxHistoryAge: 2592000, // default value
DiskFetchFrequency: 5, // default value
MaxHistoryAge: 2592000, // default value
DatabaseFilePath: "./data.db",
Listen: ":8080",
}
@@ -35,12 +35,6 @@ func GetConfiguration() DHConfig {
}
}
if val, exists := os.LookupEnv("MEMORY_DUMP_FREQUENCY"); exists {
if intValue, err := strconv.Atoi(val); err == nil {
config.MemoryDumpFrequency = intValue
}
}
if val, exists := os.LookupEnv("MAX_HISTORY_AGE"); exists {
if intValue, err := strconv.Atoi(val); err == nil {
config.MaxHistoryAge = intValue
@@ -51,5 +45,9 @@ func GetConfiguration() DHConfig {
config.Listen = val
}
if val, exists := os.LookupEnv("DATABASE_FILE_PATH"); exists {
config.DatabaseFilePath = val
}
return config
}