Add version number to status endpoint
This commit is contained in:
parent
9ae3f1a267
commit
18e322c5e1
@ -21,6 +21,7 @@ type config struct {
|
|||||||
InstanceDetails InstanceDetails `yaml:"instanceDetails"`
|
InstanceDetails InstanceDetails `yaml:"instanceDetails"`
|
||||||
S3 S3 `yaml:"s3"`
|
S3 S3 `yaml:"s3"`
|
||||||
VersionInfo string `yaml:"-"` // For storing the version/build number
|
VersionInfo string `yaml:"-"` // For storing the version/build number
|
||||||
|
VersionNumber string `yaml:"-"`
|
||||||
VideoSettings videoSettings `yaml:"videoSettings"`
|
VideoSettings videoSettings `yaml:"videoSettings"`
|
||||||
WebServerPort int `yaml:"webServerPort"`
|
WebServerPort int `yaml:"webServerPort"`
|
||||||
YP YP `yaml:"yp"`
|
YP YP `yaml:"yp"`
|
||||||
@ -228,7 +229,7 @@ func (q *StreamQuality) GetEncoderPreset() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Load tries to load the configuration file
|
//Load tries to load the configuration file
|
||||||
func Load(filePath string, versionInfo string) error {
|
func Load(filePath string, versionInfo string, versionNumber string) error {
|
||||||
Config = new(config)
|
Config = new(config)
|
||||||
_default = getDefaults()
|
_default = getDefaults()
|
||||||
|
|
||||||
@ -237,6 +238,6 @@ func Load(filePath string, versionInfo string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Config.VersionInfo = versionInfo
|
Config.VersionInfo = versionInfo
|
||||||
|
Config.VersionNumber = versionNumber
|
||||||
return Config.verifySettings()
|
return Config.verifySettings()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/owncast/owncast/config"
|
||||||
"github.com/owncast/owncast/models"
|
"github.com/owncast/owncast/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ func GetStatus() models.Status {
|
|||||||
SessionMaxViewerCount: _stats.SessionMaxViewerCount,
|
SessionMaxViewerCount: _stats.SessionMaxViewerCount,
|
||||||
LastDisconnectTime: _stats.LastDisconnectTime,
|
LastDisconnectTime: _stats.LastDisconnectTime,
|
||||||
LastConnectTime: _stats.LastConnectTime,
|
LastConnectTime: _stats.LastConnectTime,
|
||||||
|
VersionNumber: config.Config.VersionNumber,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
main.go
12
main.go
@ -28,7 +28,7 @@ var (
|
|||||||
func main() {
|
func main() {
|
||||||
configureLogging()
|
configureLogging()
|
||||||
|
|
||||||
log.Infoln(getVersion())
|
log.Infoln(getReleaseString())
|
||||||
|
|
||||||
configFile := flag.String("configFile", "config.yaml", "Config File full path. Defaults to current folder")
|
configFile := flag.String("configFile", "config.yaml", "Config File full path. Defaults to current folder")
|
||||||
dbFile := flag.String("database", "", "Path to the database file.")
|
dbFile := flag.String("database", "", "Path to the database file.")
|
||||||
@ -47,7 +47,7 @@ func main() {
|
|||||||
log.SetLevel(log.InfoLevel)
|
log.SetLevel(log.InfoLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := config.Load(*configFile, getVersion()); err != nil {
|
if err := config.Load(*configFile, getReleaseString(), getVersionNumber()); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
config.Config.EnableDebugFeatures = *enableDebugOptions
|
config.Config.EnableDebugFeatures = *enableDebugOptions
|
||||||
@ -75,11 +75,15 @@ func main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//getVersion gets the version string
|
//getReleaseString gets the version string
|
||||||
func getVersion() string {
|
func getReleaseString() string {
|
||||||
return fmt.Sprintf("Owncast v%s-%s (%s)", BuildVersion, BuildType, GitCommit)
|
return fmt.Sprintf("Owncast v%s-%s (%s)", BuildVersion, BuildType, GitCommit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getVersionNumber() string {
|
||||||
|
return BuildVersion
|
||||||
|
}
|
||||||
|
|
||||||
func configureLogging() {
|
func configureLogging() {
|
||||||
logging.Setup()
|
logging.Setup()
|
||||||
log.SetFormatter(&log.TextFormatter{
|
log.SetFormatter(&log.TextFormatter{
|
||||||
|
@ -11,4 +11,6 @@ type Status struct {
|
|||||||
|
|
||||||
LastConnectTime utils.NullTime `json:"lastConnectTime"`
|
LastConnectTime utils.NullTime `json:"lastConnectTime"`
|
||||||
LastDisconnectTime utils.NullTime `json:"lastDisconnectTime"`
|
LastDisconnectTime utils.NullTime `json:"lastDisconnectTime"`
|
||||||
|
|
||||||
|
VersionNumber string `json:"versionNumber"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user