forked from TripwireTeam/tripwire
37 lines
718 B
Go
37 lines
718 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
// func notFoundStub(w http.ResponseWriter, r *http.Request) {
|
|
// err := YggError{Code: 404, Error: "Not Found", ErrorMessage: "The server has not found anything matching the request URI"}
|
|
// sendError(w, err)
|
|
// }
|
|
|
|
func handleRequests() {
|
|
r := mux.NewRouter().StrictSlash(true)
|
|
err := loadConfig()
|
|
if err != nil {
|
|
log.Fatalln("Failed to load config.yaml:", err)
|
|
}
|
|
registerAuthEndpoints(r)
|
|
registerSessionEndpoints(r)
|
|
log.Println("Tripwire started.")
|
|
log.Fatal(http.ListenAndServe(":10000", r))
|
|
}
|
|
|
|
func main() {
|
|
log.Println("Tripwire initializing...")
|
|
os.Mkdir("skins", 0755)
|
|
initDB()
|
|
|
|
handleRequests()
|
|
|
|
defer DB.Close()
|
|
}
|