Initial commit

This commit is contained in:
Carl Pearson
2024-09-06 10:47:41 -06:00
commit 1720727c9e
15 changed files with 721 additions and 0 deletions

41
config.go Normal file
View File

@@ -0,0 +1,41 @@
package main
import (
"errors"
"fmt"
"os"
)
func getDownloadDir() string {
value, exists := os.LookupEnv("YTDLP_SITE_DOWNLOAD_DIR")
if exists {
return value
}
return "downloads"
}
func getConfigDir() string {
value, exists := os.LookupEnv("YTDLP_SITE_CONFIG_DIR")
if exists {
return value
}
return "config"
}
func getAdminInitialPassword() (string, error) {
key := "YTDLP_SITE_ADMIN_INITIAL_PASSWORD"
value, exists := os.LookupEnv(key)
if exists {
return value, nil
}
return "", errors.New(fmt.Sprintf("please set %s", key))
}
func getSessionAuthKey() ([]byte, error) {
key := "YTDLP_SITE_SESSION_AUTH_KEY"
value, exists := os.LookupEnv(key)
if exists {
return []byte(value), nil
}
return []byte{}, errors.New(fmt.Sprintf("please set %s", key))
}