Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Add support for specifying the path for chat db. Closes #61
Gabe Kangasb13e5c3d2592
diff --git a/config/config.go b/config/config.goindex f9e4417e55..af3747e21d 100644--- a/config/config.go+++ b/config/config.go@@ -15,18 +15,19 @@ import (var Config *configtype config struct {- IPFS ipfs `yaml:"ipfs"`- PublicHLSPath string `yaml:"publicHLSPath"`- PrivateHLSPath string `yaml:"privateHLSPath"`- VideoSettings videoSettings `yaml:"videoSettings"`- Files files `yaml:"files"`- FFMpegPath string `yaml:"ffmpegPath"`- WebServerPort int `yaml:"webServerPort"`- S3 s3 `yaml:"s3"`- InstanceDetails InstanceDetails `yaml:"instanceDetails"`- VersionInfo string `yaml:"-"`- DisableWebFeatures bool `yaml:"disableWebFeatures"`- EnableDebugFeatures bool `yaml:"-"`+ ChatDatabaseFilePath string `yaml:"chatDatabaseFile"`+ DisableWebFeatures bool `yaml:"disableWebFeatures"`+ EnableDebugFeatures bool `yaml:"-"`+ FFMpegPath string `yaml:"ffmpegPath"`+ Files files `yaml:"files"`+ IPFS ipfs `yaml:"ipfs"`+ InstanceDetails InstanceDetails `yaml:"instanceDetails"`+ PrivateHLSPath string `yaml:"privateHLSPath"`+ PublicHLSPath string `yaml:"publicHLSPath"`+ S3 s3 `yaml:"s3"`+ VersionInfo string `yaml:"-"`+ VideoSettings videoSettings `yaml:"videoSettings"`+ WebServerPort int `yaml:"webServerPort"`}// InstanceDetails defines the user-visible information about this particular instance.diff --git a/core/chat/chat.go b/core/chat/chat.goindex 6bf51c4c32..85141a0337 100644--- a/core/chat/chat.go+++ b/core/chat/chat.go@@ -9,6 +9,8 @@ import (//Setup sets up the chat serverfunc Setup(listener models.ChatListener) {+ setupPersistence()+messages := []models.ChatMessage{}clients := make(map[string]*Client)addCh := make(chan *Client)diff --git a/core/chat/persistence.go b/core/chat/persistence.goindex ab94423f5b..cc85fe8678 100644--- a/core/chat/persistence.go+++ b/core/chat/persistence.go@@ -5,6 +5,7 @@ import ("os""time"+ "github.com/gabek/owncast/config""github.com/gabek/owncast/models""github.com/gabek/owncast/utils"_ "github.com/mattn/go-sqlite3"@@ -13,11 +14,11 @@ import (var _db *sql.DB-func init() {- file := "./chat.db"+func setupPersistence() {+ file := config.Config.ChatDatabaseFilePath// Create empty DB file if it doesn't exist.if !utils.DoesFileExists(file) {- log.Traceln("Creating new chat history database...")+ log.Traceln("Creating new chat history database at", file)_, err := os.Create(file)if err != nil {diff --git a/main.go b/main.goindex b3fe128541..5902478cc5 100644--- a/main.go+++ b/main.go@@ -28,6 +28,7 @@ func main() {log.Infoln(getVersion())configFile := flag.String("configFile", "config.yaml", "Config File full path. Defaults to current folder")+ chatDbFile := flag.String("chatDatabase", "", "Path to the chat database file.")enableDebugOptions := flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.")enableVerboseLogging := flag.Bool("enableVerboseLogging", false, "Enable additional logging.")@@ -48,6 +49,12 @@ func main() {}config.Config.EnableDebugFeatures = *enableDebugOptions+ if *chatDbFile != "" {+ config.Config.ChatDatabaseFilePath = *chatDbFile+ } else if config.Config.ChatDatabaseFilePath == "" {+ config.Config.ChatDatabaseFilePath = "chat.db"+ }+// starts the coreif err := core.Start(); err != nil {log.Error("failed to start the core package")