mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-18 17:34:02 +02:00
(temporary) show gluetun-servers repository shape
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user