Files
goodBaby/configs/config.go
T

32 lines
571 B
Go
Raw Normal View History

2025-10-06 16:23:56 +08:00
package configs
import (
"encoding/json"
"os"
)
2026-04-05 10:36:22 +08:00
// type DingtalkBot struct {
// AccessToken string `json:"access_token"`
// Secret string `json:"secret"`
// }
2025-10-06 16:23:56 +08:00
type Config struct {
2026-04-05 10:36:22 +08:00
EnableRegistry bool `json:"enable_registry"`
TimeoutDurationHours int `json:"timeout_duration_hours"`
}
2025-10-07 17:43:50 +08:00
// Get config from json file
2025-10-06 16:23:56 +08:00
func GetConfig() (config Config, err error) {
content, err := os.ReadFile("config.json")
if err != nil {
return config, err
}
err = json.Unmarshal(content, &config)
if err != nil {
return config, err
}
return config, nil
}