func main() { flags.Parse(os.Args[1:]) var err error var conf *config.Config //load configuration from either confFile or Env's CONFIG variable conf, err = config.New(*confFile, os.Getenv("CONFIG")) if err != nil { logme.Fatal(err) } //create a new Releasidier app. app, err := releasifier.New(conf) if err != nil { logme.Fatal(err) } //start the Releasifier's App. //this will block until app stops, either by panic or exit signal app.Start() logme.Info("App is shutting down.") app.Exit() }
//New makes a new and setup releasifer app's settings func New(conf *config.Config) (*Releasifier, error) { logme.Info("Releasifier started at " + conf.Server.Bind) app := &Releasifier{conf: conf} //setup security security.Setup(conf) //Start a new DB session _, err := data.NewDBWithConfig(conf) if err != nil { logme.Fatal(err) } return app, nil }