package main

import (
	conf "oc-search/conf"
	_ "oc-search/routers"
	_ "oc-search/views"

	"github.com/beego/beego/logs"
	beego "github.com/beego/beego/v2/server/web"
)


func main() {

	loadConfig()

	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.SetStaticPath("/favicon.ico", "/static/favicon.ico")
	beego.BConfig.WebConfig.DirectoryIndex = true
	beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"

	beego.Run()
}

// Initialising the config in the init so that the oc-catalog API receives it 

func loadConfig(){
	log := logs.NewLogger(10000)
	log.SetLogger("console")


	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.SetStaticPath("/favicon.ico", "/static/favicon.ico")
	beego.BConfig.WebConfig.DirectoryIndex = true
	beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"

	logs.Info("Will contact oc-catalog at : %v", conf.GetConfig().OcCatalogUrl)

	beego.Run()
}
