package main

import (
	"os"

	"git.paulbsd.com/paulbsd/dip/src/config"
	"git.paulbsd.com/paulbsd/dip/src/dip"
	"git.paulbsd.com/paulbsd/dip/src/ws"
	staticfiles "git.paulbsd.com/paulbsd/dip/static"
	templatefiles "git.paulbsd.com/paulbsd/dip/templates"
	"git.paulbsd.com/paulbsd/dip/utils"
)

func main() {
	var config config.Config
	var Templates = &templatefiles.Templates
	var Static = &staticfiles.Static
	utils.Flags(&config.Host, &config.Port)

	ws := ws.WS{}
	ws.Page.Title = "Public IP Address Service"
	dip.Init()

	memcacheconn, ok := os.LookupEnv("MEMCACHECONN")
	if ok {
		dip.MemcacheConn = memcacheconn
	}

	ws.RunServer(config, Templates, Static)
}
