diff --git a/config.go b/config.go index adef269..ee5457e 100644 --- a/config.go +++ b/config.go @@ -4,6 +4,11 @@ type Config struct { MirrorRoot string MirrorURL string Port string + Auth AuthConfig +} + +type AuthConfig struct { + Token string } func NewConfig() *Config { @@ -11,5 +16,6 @@ func NewConfig() *Config { MirrorRoot: "/home/ewpt3ch/dev/pacman-cache-server/tmprepo", MirrorURL: "https://us.mirrors.cicku.me/archlinux/", Port: "8090", + Auth: AuthConfig{Token: "FakeToken"}, } } diff --git a/main.go b/main.go index e0b913a..8dfbb8c 100644 --- a/main.go +++ b/main.go @@ -19,6 +19,7 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("GET /{repo}/os/{arch}/{file}", srv.handlePackage) + mux.HandleFunc("POST /api/refresh", srv.handlerRefresh) if err := srv.c.Refresh(); err != nil { log.Fatal(err)