2017-11-10 12:39:55 +01:00
|
|
|
package init
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
"fornaxian.com/pixeldrain-web/init/conf"
|
2017-11-10 12:39:55 +01:00
|
|
|
"fornaxian.com/pixeldrain-web/webcontroller"
|
2018-06-17 16:15:58 +02:00
|
|
|
"github.com/Fornaxian/config"
|
|
|
|
"github.com/Fornaxian/log"
|
2017-11-10 12:39:55 +01:00
|
|
|
"github.com/julienschmidt/httprouter"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Init initializes the Pixeldrain Web UI controllers
|
|
|
|
func Init(r *httprouter.Router, prefix string) {
|
|
|
|
log.Info("Starting web UI server (PID %v)", os.Getpid())
|
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
var webconf = &conf.PixelWebConfig{}
|
|
|
|
var _, err = config.New(
|
|
|
|
conf.DefaultConfig,
|
|
|
|
"",
|
|
|
|
"pdwebconf.toml",
|
|
|
|
webconf,
|
|
|
|
true,
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Failed to load config file: %s", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
2017-11-10 12:39:55 +01:00
|
|
|
|
2018-06-17 16:15:58 +02:00
|
|
|
webcontroller.New(r, prefix, webconf)
|
2017-11-10 12:39:55 +01:00
|
|
|
}
|