refresh endpoint
This commit is contained in:
@@ -4,6 +4,11 @@ type Config struct {
|
|||||||
MirrorRoot string
|
MirrorRoot string
|
||||||
MirrorURL string
|
MirrorURL string
|
||||||
Port string
|
Port string
|
||||||
|
Auth AuthConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthConfig struct {
|
||||||
|
Token string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig() *Config {
|
func NewConfig() *Config {
|
||||||
@@ -11,5 +16,6 @@ func NewConfig() *Config {
|
|||||||
MirrorRoot: "/home/ewpt3ch/dev/pacman-cache-server/tmprepo",
|
MirrorRoot: "/home/ewpt3ch/dev/pacman-cache-server/tmprepo",
|
||||||
MirrorURL: "https://us.mirrors.cicku.me/archlinux/",
|
MirrorURL: "https://us.mirrors.cicku.me/archlinux/",
|
||||||
Port: "8090",
|
Port: "8090",
|
||||||
|
Auth: AuthConfig{Token: "FakeToken"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ func main() {
|
|||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("GET /{repo}/os/{arch}/{file}", srv.handlePackage)
|
mux.HandleFunc("GET /{repo}/os/{arch}/{file}", srv.handlePackage)
|
||||||
|
mux.HandleFunc("POST /api/refresh", srv.handlerRefresh)
|
||||||
|
|
||||||
if err := srv.c.Refresh(); err != nil {
|
if err := srv.c.Refresh(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user