31 lines
518 B
Go
31 lines
518 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
|
||
|
"git.t-juice.club/microfilm/users/server"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
f, err := os.Open("mf-users.toml")
|
||
|
if err != nil {
|
||
|
fmt.Printf("Error opening config: %s", err)
|
||
|
os.Exit(1)
|
||
|
}
|
||
|
|
||
|
cfg, err := server.ConfigFromReader(f)
|
||
|
if err != nil {
|
||
|
fmt.Printf("Error parsing config: %s", err)
|
||
|
os.Exit(1)
|
||
|
}
|
||
|
srv, err := server.NewServer(cfg)
|
||
|
if err != nil {
|
||
|
fmt.Printf("Error parsing config: %s", err)
|
||
|
os.Exit(2)
|
||
|
}
|
||
|
|
||
|
fmt.Printf("Starting server: %s\n", srv.Addr)
|
||
|
srv.ListenAndServe()
|
||
|
}
|