0

Move stats.json to data dir

This commit is contained in:
Gabe Kangas 2020-11-12 22:34:49 -08:00
parent 6df6b97815
commit 934285c55b
2 changed files with 4 additions and 7 deletions

View File

@ -7,6 +7,7 @@ const (
PrivateHLSStoragePath = "hls"
GeoIPDatabasePath = "data/GeoLite2-City.mmdb"
ExtraInfoFile = "data/content.md"
StatsFile = "data/stats.json"
)
var (

View File

@ -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
}