multiple content per fetcher
This commit is contained in:
@@ -1,16 +1,45 @@
|
||||
package lib
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
WikiBaseURL string
|
||||
WikiToken string
|
||||
RedmineBaseURL string
|
||||
RedmineKey string
|
||||
GiteaToken string
|
||||
GiteaBaseURL string
|
||||
GiteaRepos []string
|
||||
DiscordWebhook string
|
||||
DiscordFake bool
|
||||
Interval time.Duration
|
||||
WikiBaseURL string
|
||||
WikiToken string
|
||||
WikiContentLimit int
|
||||
RedmineBaseURL string
|
||||
RedmineKey string
|
||||
RedmineContentLimit int
|
||||
GiteaToken string
|
||||
GiteaBaseURL string
|
||||
GiteaRepos []string
|
||||
GiteaContentLimit int
|
||||
DiscordWebhook string
|
||||
DiscordFake bool
|
||||
Interval time.Duration
|
||||
}
|
||||
|
||||
func envToInteger(key string, defaultValue int) int {
|
||||
valueStr := os.Getenv(key)
|
||||
if valueStr == "" {
|
||||
return defaultValue
|
||||
}
|
||||
value, err := strconv.Atoi(valueStr)
|
||||
if err != nil {
|
||||
return defaultValue
|
||||
}
|
||||
return value
|
||||
|
||||
}
|
||||
|
||||
func loadEnv() {
|
||||
if err := godotenv.Load(); err != nil {
|
||||
log.Println("Warning: .env file not found, using environment variables")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user