Files
ytdlp-site/config.go
Carl Pearson 1720727c9e Initial commit
2024-09-06 10:47:41 -06:00

42 lines
781 B
Go

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))
}