Personal Git forge.

Code git clone ssh://git.poy.ooo:6969/~poyo/farga ZIP
main.go / 951B #28e93733
Raw
package mainimport (	"flag"	"fmt"	"log"	"net/http"	"os"	"time"	"farga/app"	"farga/config"	"farga/db"	"farga/db/types"	"farga/ssh")func main() {	config := config.New()	d, err := db.New()	if err != nil {		panic(err)	}	newAdmin := flag.Bool("new-admin", false, "Create an invite which will set the user as Admin on registration.")	flag.Parse()	if *newAdmin {		invite, err := d.NewInvite(db.NewInviteOptions{			Length:   config.InviteTokenLength,			Duration: time.Hour,			Role:     uint(types.RoleAdmin),		})		if err != nil {			log.Fatal(err)		}		fmt.Printf("Your ADMIN invite token is: '%s'. DO NOT SHARE IT.\n", invite.Token)		os.Exit(0)	}	app := app.New(d, config)	go d.CleanupTicker()	go ssh.ServeSSH(d, config.SSHPort)	fmt.Printf("Serving website on http://%s:%v\n", config.Domain, config.Port)	err = http.ListenAndServe(fmt.Sprintf(":%v", config.Port), app.Handler)	if err != nil {		panic(err)	}}