dyndns-server/main.go

31 lines
438 B
Go

package main
import (
"net/http"
"github.com/BurntSushi/toml"
)
type tomlConfig struct {
Database databaseConfig
}
var config tomlConfig
func main() {
_, err := toml.DecodeFile("config.toml", &config)
if err != nil {
panic(err)
}
db, err := prepareDatabase()
if err != nil {
panic(err)
}
defer db.Close()
http.HandleFunc("/", basicAuth(db))
err = http.ListenAndServe(":3002", nil)
if err != nil {
panic(err)
}
}