mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
6d2ce95305
Co-authored-by: Copilot <copilot@github.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"net/http"
|
|
"os"
|
|
"path/filepath"
|
|
"time"
|
|
|
|
"github.com/qdm12/gluetun/pkg/updaters"
|
|
"github.com/qdm12/log"
|
|
)
|
|
|
|
func main() {
|
|
defaultOutputDir := filepath.Join("pkg", "servers")
|
|
outputDir := flag.String("output-dir", defaultOutputDir,
|
|
"directory to write per-provider JSON files to")
|
|
protonEmail := flag.String("proton-email", os.Getenv("GLUETUN_PROTON_EMAIL"),
|
|
"ProtonVPN account email")
|
|
protonPassword := flag.String("proton-password", os.Getenv("GLUETUN_PROTON_PASSWORD"),
|
|
"ProtonVPN account password")
|
|
ipinfoToken := flag.String("ipinfo-token", os.Getenv("IPINFO_TOKEN"),
|
|
"IPInfo token used for public IP lookups")
|
|
flag.Parse()
|
|
|
|
client := &http.Client{Timeout: time.Minute}
|
|
settings := updaters.UpdateAllSettings{
|
|
OutputPath: outputDir,
|
|
ProtonEmail: protonEmail,
|
|
ProtonPassword: protonPassword,
|
|
IpinfoToken: ipinfoToken,
|
|
}
|
|
|
|
logger := log.New()
|
|
err := updaters.UpdateAll(context.Background(), client, logger, settings)
|
|
if err != nil {
|
|
logger.Errorf("update failed: %v", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
logger.Infof("update completed successfully, data files written to %s", *outputDir)
|
|
}
|