owncast/config/defaults.go
Gabe Kangas 9b7784634b
First pass at YP registration/configuration (#209)
* Spike: Ping YP service with instance details

* WIP: Add to the config to support YP

* Add YP response endpoint

* Handle YP errors. Use config. Off by default

* Show message about YP support on launch

* Add animated gif preview when generating thumb

* Increase quality of preview gif and only create it if YP is enabled

* Do not allow re-registration by clearing the key

* Make large and small logos actually structured

* Change log level

* Fix default YP service URL

* Point to default hostname

* Set default value for YP to false
2020-10-01 23:55:38 -07:00

44 lines
1.1 KiB
Go

package config
import (
"log"
"os/exec"
"strings"
)
func getDefaults() config {
defaults := config{}
defaults.WebServerPort = 8080
defaults.FFMpegPath = getDefaultFFMpegPath()
defaults.VideoSettings.ChunkLengthInSeconds = 4
defaults.Files.MaxNumberInPlaylist = 5
defaults.PublicHLSPath = "webroot/hls"
defaults.PrivateHLSPath = "hls"
defaults.VideoSettings.OfflineContent = "static/offline.m4v"
defaults.InstanceDetails.ExtraInfoFile = "/static/content.md"
defaults.YP.Enabled = false
defaults.YP.YPServiceURL = "https://yp.owncast.online"
defaultQuality := StreamQuality{
IsAudioPassthrough: true,
VideoBitrate: 1200,
EncoderPreset: "veryfast",
Framerate: 24,
}
defaults.VideoSettings.StreamQualities = []StreamQuality{defaultQuality}
return defaults
}
func getDefaultFFMpegPath() string {
cmd := exec.Command("which", "ffmpeg")
out, err := cmd.CombinedOutput()
if err != nil {
log.Panicln("Unable to determine path to ffmpeg. Please specify it in the config file.")
}
path := strings.TrimSpace(string(out))
return path
}