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