config.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package config
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. // These are runtime-set values used for configuration.
  7. // DatabaseFilePath is the path to the file ot be used as the global database for this run of the application.
  8. var DatabaseFilePath = "data/owncast.db"
  9. // LogDirectory is the path to various log files.
  10. var LogDirectory = "./data/logs"
  11. // TempDir is where we store temporary files.
  12. var TempDir = "./data/tmp"
  13. // EnableDebugFeatures will print additional data to help in debugging.
  14. var EnableDebugFeatures = false
  15. // VersionNumber is the current version string.
  16. var VersionNumber = StaticVersionNumber
  17. // WebServerPort is the port for Owncast's webserver that is used for this execution of the service.
  18. var WebServerPort = 8080
  19. // WebServerIP is the IP address to bind the web server to. All interfaces by default.
  20. var WebServerIP = "0.0.0.0"
  21. // InternalHLSListenerPort is the port for HLS writes that is used for this execution of the service.
  22. var InternalHLSListenerPort = "8927"
  23. // GitCommit is an optional commit this build was made from.
  24. var GitCommit = ""
  25. // BuildPlatform is the optional platform this release was built for.
  26. var BuildPlatform = "dev"
  27. // EnableAutoUpdate will explicitly enable in-place auto-updates via the admin.
  28. var EnableAutoUpdate = false
  29. // A temporary stream key that can be set via the command line.
  30. var TemporaryStreamKey = ""
  31. // EnableReplayFeatures will enable replay features.
  32. var EnableReplayFeatures = true
  33. // GetCommit will return an identifier used for identifying the point in time this build took place.
  34. func GetCommit() string {
  35. if GitCommit == "" {
  36. GitCommit = time.Now().Format("20060102")
  37. }
  38. return GitCommit
  39. }
  40. // DefaultForbiddenUsernames are a list of usernames forbidden from being used in chat.
  41. var DefaultForbiddenUsernames = []string{
  42. "owncast", "operator", "admin", "system",
  43. }
  44. // MaxSocketPayloadSize is the maximum payload we will allow to to be received via the chat socket.
  45. const MaxSocketPayloadSize = 2048
  46. // GetReleaseString gets the version string.
  47. func GetReleaseString() string {
  48. versionNumber := VersionNumber
  49. buildPlatform := BuildPlatform
  50. gitCommit := GetCommit()
  51. return fmt.Sprintf("Owncast v%s-%s (%s)", versionNumber, buildPlatform, gitCommit)
  52. }