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 {
|
2020-01-19 09:12:51 +01:00
|
|
|
fatalInProd(err, "failed to read config")
|
2019-09-27 08:19:24 +02:00
|
|
|
}
|
|
|
|
|
2020-01-19 09:12:51 +01:00
|
|
|
if conf != nil {
|
|
|
|
if db, err = initDBPool(conf); err != nil {
|
|
|
|
fatalInProd(err, "failed to connect to database")
|
|
|
|
}
|
|
|
|
|
|
|
|
initCompiler()
|
|
|
|
initAllowList(confPath)
|
|
|
|
initPreparedList()
|
2019-09-26 06:35:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
initWatcher(confPath)
|
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|