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
|
|
|
|
|
2020-02-03 07:21:07 +01:00
|
|
|
initWatcher(confPath)
|
|
|
|
|
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-02-03 07:21:07 +01:00
|
|
|
db, err = initDBPool(conf)
|
2020-01-26 07:10:54 +01:00
|
|
|
|
2020-02-03 07:21:07 +01:00
|
|
|
if err != nil {
|
|
|
|
fatalInProd(err, "failed to connect to database")
|
2019-09-26 06:35:31 +02:00
|
|
|
}
|
|
|
|
|
2020-02-22 21:58:37 +01:00
|
|
|
if conf != nil && db != nil {
|
|
|
|
initCrypto()
|
|
|
|
initCompiler()
|
|
|
|
initResolvers()
|
|
|
|
initAllowList(confPath)
|
|
|
|
initPreparedList(confPath)
|
|
|
|
}
|
2019-09-26 06:35:31 +02:00
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|