add the ability to pass in an auth key file
This commit is contained in:
parent
3673cf1ebf
commit
9a867c7438
@ -15,7 +15,7 @@
|
||||
in {
|
||||
tsvnstat = pkgs.buildGoModule {
|
||||
pname = "tsvnstat";
|
||||
version = "v0.0.1";
|
||||
version = "v0.0.2";
|
||||
src = ./.;
|
||||
|
||||
vendorSha256 = "sha256-RNhu1gQ62Hg8Fhiw9uIS+b4YaAHtZMaqbelMKv+oZjM=";
|
||||
|
7
main.go
7
main.go
@ -51,10 +51,17 @@ func main() {
|
||||
|
||||
name := flag.String("name", "", "name of service")
|
||||
dir := flag.String("dir", tmpDir, "directory containing vnstat images")
|
||||
key := flag.String("key", "", "path to file containing the api key")
|
||||
flag.Parse()
|
||||
|
||||
keyData, err := os.ReadFile(*key)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
s := &tsnet.Server{
|
||||
Hostname: *name,
|
||||
AuthKey: string(keyData),
|
||||
}
|
||||
|
||||
ln, err := s.Listen("tcp", ":80")
|
||||
|
Loading…
Reference in New Issue
Block a user