2019-09-26 06:35:31 +02:00
|
|
|
package serv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func cmdServ(cmd *cobra.Command, args []string) {
|
|
|
|
var err error
|
|
|
|
|
2019-09-27 08:19:24 +02:00
|
|
|
if conf, err = initConf(); err != nil {
|
2019-11-25 08:22:33 +01:00
|
|
|
errlog.Fatal().Err(err).Msg("failed to read config")
|
2019-09-27 08:19:24 +02:00
|
|
|
}
|
|
|
|
|
2019-09-26 06:35:31 +02:00
|
|
|
db, err = initDBPool(conf)
|
|
|
|
if err != nil {
|
2019-11-25 08:22:33 +01:00
|
|
|
errlog.Fatal().Err(err).Msg("failed to connect to database")
|
2019-09-26 06:35:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
initCompiler()
|
|
|
|
initAllowList(confPath)
|
|
|
|
initPreparedList()
|
|
|
|
initWatcher(confPath)
|
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|