This commit is contained in:
2023-04-16 12:21:01 +07:00
parent 4ba1f9aeac
commit a44381323a
13 changed files with 642 additions and 65 deletions

View File

@ -1,38 +0,0 @@
package config
import (
"log"
"os"
"github.com/joho/godotenv"
)
var DownloadFolder string
var HTTPPort string
var DBName string
var TMDbApiKey string
func Load() {
if err := godotenv.Load(); err != nil {
log.Println("Error loading .env file ...")
log.Println("Using default configuration")
}
if DownloadFolder = os.Getenv("DOWNLOAD_FOLDER"); DownloadFolder == "" {
DownloadFolder = "/home/rouggy/torrents/rtorrent/Race"
}
if HTTPPort = os.Getenv("HTTP_PORT"); HTTPPort == "" {
HTTPPort = "9000"
}
if DBName = os.Getenv("DB_NAME"); DBName == "" {
DBName = "racerdb"
}
if TMDbApiKey = os.Getenv("TMDB_APIKEY"); TMDbApiKey == "" {
log.Println("TMDb Api Key cannot be empty...")
os.Exit(1)
}
}