diff --git a/config/constants.go b/config/constants.go index 2a53d2220..ef68dcafd 100644 --- a/config/constants.go +++ b/config/constants.go @@ -7,6 +7,7 @@ const ( PrivateHLSStoragePath = "hls" GeoIPDatabasePath = "data/GeoLite2-City.mmdb" ExtraInfoFile = "data/content.md" + StatsFile = "data/stats.json" ) var ( diff --git a/core/stats.go b/core/stats.go index 0c55b62da..6125a530f 100644 --- a/core/stats.go +++ b/core/stats.go @@ -17,10 +17,6 @@ import ( "github.com/owncast/owncast/utils" ) -const ( - statsFilePath = "stats.json" -) - var l = sync.Mutex{} func setupStats() error { @@ -116,7 +112,7 @@ func saveStatsToFile() error { return err } - f, err := os.Create(statsFilePath) + f, err := os.Create(config.StatsFile) if err != nil { return err } @@ -135,11 +131,11 @@ func getSavedStats() (models.Stats, error) { Clients: make(map[string]models.Client), } - if !utils.DoesFileExists(statsFilePath) { + if !utils.DoesFileExists(config.StatsFile) { return result, nil } - jsonFile, err := ioutil.ReadFile(statsFilePath) + jsonFile, err := ioutil.ReadFile(config.StatsFile) if err != nil { return result, nil }