github.com/lologarithm/mattermost-server@v5.3.2-0.20181002060438-c82a84ed765b+incompatible/app/timezone.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package app 5 6 import ( 7 "github.com/mattermost/mattermost-server/model" 8 "github.com/mattermost/mattermost-server/utils" 9 ) 10 11 func (a *App) Timezones() model.SupportedTimezones { 12 if cfg := a.timezones.Load(); cfg != nil { 13 return cfg.(model.SupportedTimezones) 14 } 15 return model.SupportedTimezones{} 16 } 17 18 func (a *App) LoadTimezones() { 19 timezonePath := "timezones.json" 20 21 if a.Config().TimezoneSettings.SupportedTimezonesPath != nil && len(*a.Config().TimezoneSettings.SupportedTimezonesPath) > 0 { 22 timezonePath = *a.Config().TimezoneSettings.SupportedTimezonesPath 23 } 24 25 timezoneCfg := utils.LoadTimezones(timezonePath) 26 27 a.timezones.Store(timezoneCfg) 28 }