()
| 91 | } |
| 92 | |
| 93 | func Start() { |
| 94 | re.Init() |
| 95 | viper.Init() |
| 96 | dir.Init() |
| 97 | log.Init() |
| 98 | global.LOG.Info("agent startup: logger initialized") |
| 99 | db.Init() |
| 100 | global.LOG.Info("agent startup: database initialized") |
| 101 | migration.Init() |
| 102 | global.LOG.Info("agent startup: migration initialized") |
| 103 | i18n.Init() |
| 104 | global.LOG.Info("agent startup: i18n initialized") |
| 105 | cache.Init() |
| 106 | global.LOG.Info("agent startup: cache initialized") |
| 107 | app.Init() |
| 108 | global.LOG.Info("agent startup: app initialized") |
| 109 | lang.Init() |
| 110 | global.LOG.Info("agent startup: language initialized") |
| 111 | validator.Init() |
| 112 | global.LOG.Info("agent startup: validator initialized") |
| 113 | cron.Run() |
| 114 | global.LOG.Info("agent startup: cron initialized") |
| 115 | hook.Init() |
| 116 | global.LOG.Info("agent startup: hook initialized") |
| 117 | go firewall.Init() |
| 118 | global.LOG.Info("agent startup: firewall init scheduled") |
| 119 | InitOthers() |
| 120 | global.LOG.Info("agent startup: edition initialized") |
| 121 | |
| 122 | rootRouter := router.Routers() |
| 123 | global.LOG.Info("agent startup: router initialized") |
| 124 | |
| 125 | server := &http.Server{ |
| 126 | Handler: rootRouter, |
| 127 | } |
| 128 | |
| 129 | if global.CONF.Base.Mode != "stable" { |
| 130 | gin.SetMode(gin.DebugMode) |
| 131 | } else { |
| 132 | gin.SetMode(gin.ReleaseMode) |
| 133 | } |
| 134 | |
| 135 | if global.IsMaster { |
| 136 | global.LOG.Infof("agent startup: master mode, preparing unix socket %s", masterSocketPath) |
| 137 | if err := prepareMasterSocketDir(masterSocketDir); err != nil { |
| 138 | panic(err) |
| 139 | } |
| 140 | _ = os.Remove(masterSocketPath) |
| 141 | listener, err := net.Listen("unix", masterSocketPath) |
| 142 | if err != nil { |
| 143 | panic(err) |
| 144 | } |
| 145 | if err := secureMasterSocket(masterSocketPath); err != nil { |
| 146 | _ = listener.Close() |
| 147 | panic(err) |
| 148 | } |
| 149 | global.LOG.Infof("agent startup: listening on unix socket %s", masterSocketPath) |
| 150 | business.Init() |
nothing calls this directly
no test coverage detected