Bendodroid
4b41acfa7b
- Move components to separate packages - Fix HTTP header for 401 response - Add documentation
25 lines
658 B
Go
25 lines
658 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"gitlab.hamburg.ccc.de/ccchh/spaceapid/handlers"
|
|
"gitlab.hamburg.ccc.de/ccchh/spaceapid/util"
|
|
)
|
|
|
|
func main() {
|
|
log.Println("Reading configuration values")
|
|
config := util.GetConfiguration()
|
|
|
|
log.Println("Reading initial SpaceAPI response from", config.TemplatePath)
|
|
spaceApiResponse := util.ParseTemplate(config.TemplatePath)
|
|
|
|
// Register HTTP handlers
|
|
http.HandleFunc("/", handlers.Root(&spaceApiResponse))
|
|
http.HandleFunc("/state/open", handlers.StateOpen(config.BAUsername, config.BAPassword, &spaceApiResponse))
|
|
|
|
log.Println("Starting HTTP server...")
|
|
log.Fatalln(http.ListenAndServe(":8080", nil))
|
|
}
|