func startInstallServer() *http.Server {
	r := mux.NewRouter()
	n := negroni.Classic()
	beuboTemplateRenderer := template.BeuboTemplateRenderer{
		ReloadTemplates: true,
		CurrentTheme:    "install",
	}
	beuboTemplateRenderer.Init()
	beuboRouter := &routes.BeuboRouter{
		Renderer: &beuboTemplateRenderer,
	}
	r.NotFoundHandler = http.HandlerFunc(beuboRouter.NotFoundHandler)
	log.Println("Registering themes...")
	r = registerStaticFiles(r)
	log.Println("Registering routes...")
	r.HandleFunc("/", Install)
	n.UseHandler(r)
	srv := &http.Server{Addr: fmt.Sprintf(":%d", port), Handler: n}
	log.Println("HTTP Server listening on:", port)
	go func() {
		if err := srv.ListenAndServe(); err != http.ErrServerClosed {
			log.Fatalf("ListenAndServe(): %s", err)
		}
		log.Println("Server stopped")
	}()
	return srv
}
startInstallServer starts a http listener and presents the installation page to anyone visiting the port on the host
package beubo
import (
	"context"
	"encoding/hex"
	"errors"
	"fmt"
	"github.com/gorilla/mux"
	"github.com/gorilla/securecookie"
	"github.com/joho/godotenv"
	"github.com/uberswe/beubo/pkg/routes"
	"github.com/uberswe/beubo/pkg/structs"
	"github.com/uberswe/beubo/pkg/structs/page"
	"github.com/uberswe/beubo/pkg/structs/page/menu"
	"github.com/uberswe/beubo/pkg/template"
	"github.com/uberswe/beubo/pkg/utility"
	"github.com/urfave/negroni"
	"gorm.io/gorm"
	"gorm.io/gorm/logger"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"time"
)
var (
	databaseHost     = "localhost"
	databaseName     = ""
	databaseUser     = ""
	databasePassword = ""
	databasePort     = "3306"
	databaseDriver   = "mysql"
	environment      = "production"
	testuser         = ""
	testpass         = ""
	rootDir         = "./themes/"
	currentTheme    = "default"
	installed       = false  
	reloadTemplates = false
	sessionKey = securecookie.GenerateRandomKey(64)
	failures map[string]map[string]string
)
type logWriter struct {
}
func (writer logWriter) Write(bytes []byte) (int, error) {
	return fmt.Printf("[beubo] %s | %s", time.Now().Format("2006-01-02T15:04:05-07:00"), string(bytes))
}  
func settingsInit() {
	log.SetFlags(0)
	log.SetOutput(new(logWriter))
	err := godotenv.Load()
	if err != nil {
		utility.ErrorHandler(err, false)
		log.Println("Attempting to create .env file")
		writeEnv("", "", "", "", "", "", "")
	}
	rootDir = setSetting(os.Getenv("ASSETS_DIR"), rootDir)
	currentTheme = setSetting(os.Getenv("THEME"), currentTheme)
	databaseHost = setSetting(os.Getenv("DB_HOST"), databaseHost)
	databaseName = setSetting(os.Getenv("DB_NAME"), databaseName)
	databaseUser = setSetting(os.Getenv("DB_USER"), databaseUser)
	databaseDriver = setSetting(os.Getenv("DB_DRIVER"), databaseDriver)
	databasePassword = setSetting(os.Getenv("DB_PASSWORD"), databasePassword)
	shouldRefreshDatabase = setBoolSetting(os.Getenv("REFRESH_DATABASE"), shouldRefreshDatabase)
	shouldSeed = setBoolSetting(os.Getenv("SEED_DATABASE"), shouldSeed)
	environment = setSetting(os.Getenv("ENVIRONMENT"), environment)
	testpass = setSetting(os.Getenv("TEST_PASS"), testpass)
	testuser = setSetting(os.Getenv("TEST_USER"), testuser)
	sessionKeyBytes, err := hex.DecodeString(os.Getenv("SESSION_KEY"))
	utility.ErrorHandler(err, false)
	if len(sessionKeyBytes) > 1 {
		sessionKey = sessionKeyBytes
	}
	if databaseName != "" {
		installed = true
	} else {
		log.Println("No installation detected, starting install server")
		srv := startInstallServer()
		for !installed {
			time.Sleep(time.Millisecond * 100)
		}
		if err := srv.Shutdown(context.TODO()); err != nil {
			panic(err)  
		}
		log.Println("Install complete, restarting server")
		settingsInit()
	}
}