fixed path resolution

This commit is contained in:
Luxferre
2024-09-19 15:51:46 +03:00
parent e545d2c1a8
commit 51f28a6397
5 changed files with 22 additions and 8 deletions
+3 -2
View File
@@ -15,6 +15,7 @@ import (
"encoding/json"
"net/http"
"io/ioutil"
"path/filepath"
)
/* global API root URL placeholder */
@@ -124,11 +125,11 @@ func oc_process_message(rawmsg map[string]interface{}) {
/* entry point */
func owncast_run(config map[string]interface{}) {
token_path := "auth/oc-token.txt"
token_path := filepath.Join(APP_ROOT_DIR, "auth", "oc-token.txt")
token, err := ioutil.ReadFile(token_path)
token_err_msg := "[owncast] No Owncast token file provided or it is empty. "
token_err_msg += "Please generate a token in your Owncast admin panel "
token_err_msg += "and paste it into the auth/oc-token.txt file!"
token_err_msg += "and paste it into the " + token_path + " file!"
if err != nil {
log.Fatal(token_err_msg + "\nDetailed error: ", err)
}