You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main.go
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ import (
28
28
var (
29
29
datadir=flag.String("datadir", ".", "The directory to put the data in")
30
30
hostname=flag.String("hostname", "", "The server hostname, used to lookup server siteinfo annotations")
31
+
hostnameFile= flagx.FileBytes{}
31
32
maxmindurl= flagx.URL{}
32
33
routeviewv4= flagx.URL{}
33
34
routeviewv6= flagx.URL{}
@@ -49,6 +50,7 @@ var (
49
50
)
50
51
51
52
funcinit() {
53
+
flag.Var(&hostnameFile, "hostname-file", "The file containing the server hostname.")
52
54
flag.Var(&maxmindurl, "maxmind.url", "The URL for the file containing MaxMind IP metadata. Accepted URL schemes currently are: gs://bucket/file and file:./relativepath/file")
53
55
flag.Var(&routeviewv4, "routeview-v4.url", "The URL for the RouteViewIPv4 file containing ASN metadata. gs:// and file:// schemes accepted.")
54
56
flag.Var(&routeviewv6, "routeview-v6.url", "The URL for the RouteViewIPv6 file containing ASN metadata. gs:// and file:// schemes accepted.")
@@ -73,6 +75,12 @@ func main() {
73
75
flag.Parse()
74
76
rtx.Must(flagx.ArgsFromEnv(flag.CommandLine), "Could not get args from environment variables")
75
77
78
+
// If the -hostname flag was not set, try reading the hostname from the
79
+
// -hostname-file.
80
+
ifhostnameFile.String() !=""&&*hostname=="" {
81
+
*hostname=hostnameFile.String()
82
+
}
83
+
76
84
// Create the datatype directory immediately, since pusher will crash
77
85
// without it.
78
86
rtx.Must(os.MkdirAll(*datadir, 0755), "Could not create datatype dir %s", datadir)
0 commit comments