2019-09-26 00:35:31 -04:00
|
|
|
package serv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func cmdServ(cmd *cobra.Command, args []string) {
|
|
|
|
var err error
|
|
|
|
|
2019-09-27 02:19:24 -04:00
|
|
|
if conf, err = initConf(); err != nil {
|
2020-01-19 03:12:51 -05:00
|
|
|
fatalInProd(err, "failed to read config")
|
2019-09-27 02:19:24 -04:00
|
|
|
}
|
|
|
|
|
2020-01-19 03:12:51 -05:00
|
|
|
if conf != nil {
|
2020-01-26 01:10:54 -05:00
|
|
|
db, err = initDBPool(conf)
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
initCompiler()
|
|
|
|
initAllowList(confPath)
|
2020-02-01 10:54:19 -05:00
|
|
|
initPreparedList(confPath)
|
2020-01-26 01:10:54 -05:00
|
|
|
} else {
|
2020-01-19 03:12:51 -05:00
|
|
|
fatalInProd(err, "failed to connect to database")
|
|
|
|
}
|
2019-09-26 00:35:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
initWatcher(confPath)
|
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|