Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cmd/wrserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ package main

import (
"context"
"embed"
"encoding/json"
"errors"
"flag"
"fmt"
"html/template"
"io/fs"
"io/ioutil"
"log"
"net/http"
Expand All @@ -205,12 +207,13 @@ import (

"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"github.com/rakyll/statik/fs"
_ "github.com/google/webrisk/cmd/wrserver/statik"
pb "github.com/google/webrisk/internal/webrisk_proto"
"github.com/google/webrisk"
)

//go:embed public/*
var embedFS embed.FS

const (
statusPath = "/status"
findThreatPath = "/v1/uris:search"
Expand Down Expand Up @@ -533,13 +536,13 @@ func main() {
fmt.Fprintln(os.Stderr, "Unable to initialize Web Risk client: ", err)
os.Exit(1)
}
statikFS, err := fs.New()
publicFS, err := fs.Sub(embedFS, "public")
if err != nil {
fmt.Fprintln(os.Stderr, "Unable to initialize static files: ", err)
os.Exit(1)
}

srv := newServer(wr, statikFS)
srv := newServer(wr, http.FS(publicFS))
exit, down := runServer(srv)
signal.Notify(exit, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
<-down
Expand Down
41 changes: 0 additions & 41 deletions cmd/wrserver/statik/statik.go

This file was deleted.

8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module github.com/google/webrisk
go 1.19

require (
github.com/google/go-cmp v0.5.5
github.com/rakyll/statik v0.1.7
github.com/google/go-cmp v0.5.5
golang.org/x/net v0.8.0
google.golang.org/protobuf v1.29.0
)

require golang.org/x/text v0.8.0 // indirect
require (
golang.org/x/text v0.8.0 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
)
Loading
Loading